当前位置: 首页>>代码示例>>PHP>>正文


PHP osc_current_admin_locale函数代码示例

本文整理汇总了PHP中osc_current_admin_locale函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_current_admin_locale函数的具体用法?PHP osc_current_admin_locale怎么用?PHP osc_current_admin_locale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osc_current_admin_locale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extendData

 public function extendData($items)
 {
     if (defined('OC_ADMIN')) {
         $prefLocale = osc_current_admin_locale();
     } else {
         $prefLocale = osc_current_user_locale();
     }
     $results = array();
     foreach ($items as $item) {
         $descriptions = $this->conn->osc_dbFetchResults('SELECT * FROM %st_item_description WHERE fk_i_item_id = %d', DB_TABLE_PREFIX, $item['pk_i_id']);
         $item['locale'] = array();
         foreach ($descriptions as $desc) {
             if ($desc['s_title'] != "" || $desc['s_description'] != "") {
                 $item['locale'][$desc['fk_c_locale_code']] = $desc;
             }
         }
         if (isset($item['locale'][$prefLocale])) {
             $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
             $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
             $item['s_what'] = $item['locale'][$prefLocale]['s_what'];
         } else {
             $data = current($item['locale']);
             $item['s_title'] = $data['s_title'];
             $item['s_description'] = $data['s_description'];
             $item['s_what'] = $data['s_what'];
             unset($data);
         }
         $results[] = $item;
     }
     return $results;
 }
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:Item.php

示例2: processEditForm

 public function processEditForm($new_item = array(), $files = array())
 {
     $param_name = 'new_item';
     Session::newInstance()->_setForm($param_name, $new_item);
     // keep values on session
     Session::newInstance()->_keepForm($param_name);
     $default_fields = array('gn_id' => NULL, 'gn_title' => '', 'gn_description' => '', 'gn_tags' => '', 'gn_lang' => osc_current_admin_locale());
     $new_item = array_merge($default_fields, $new_item);
     if (!$new_item['gn_title']) {
         throw new Exception(__('The title must not be empty', 'gz_news'));
     }
     if (!$new_item['gn_description']) {
         throw new Exception(__('The description must not be empty', 'gz_news'));
     }
     $dao = GzNewsDao::newInstance();
     if ($new_item['gn_id']) {
         $item_exists = $dao->findByPrimaryKey($new_item['gn_id']);
         if ($item_exists == FALSE) {
             throw new Exception(__('The new does not exists anymore', 'gz_news'));
         }
     }
     $success = $dao->save($new_item);
     if ($success) {
         if (!empty($files)) {
             $this->uploadFiles($success, $files);
         }
         Session::newInstance()->_dropKeepForm($param_name);
     }
     return $success;
 }
开发者ID:faosclass,项目名称:gz_news,代码行数:30,代码来源:GzNewsModel.php

示例3: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'edit':
             if (Params::getParam("id") == '') {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=emails");
             }
             $this->_exportVariableToView("email", $this->emailManager->findByPrimaryKey(Params::getParam("id")));
             $this->doView("emails/frm.php");
             break;
         case 'edit_post':
             $id = Params::getParam("id");
             $s_internal_name = Params::getParam("s_internal_name");
             $aFieldsDescription = array();
             $postParams = Params::getParamsAsArray('', false);
             $not_empty = false;
             foreach ($postParams as $k => $v) {
                 if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                     if ($m[2] == 's_title' && $v != '') {
                         $not_empty = true;
                     }
                     $aFieldsDescription[$m[1]][$m[2]] = $v;
                 }
             }
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->emailManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->emailManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->emailManager->isIndelible($id)) {
                         $this->emailManager->updateInternalName($id, $s_internal_name);
                     }
                     osc_add_flash_ok_message(_m('The email/alert has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=emails");
                 }
                 osc_add_flash_error_message(_m('You can\'t repeat internal name'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('The email couldn\'t be updated, at least one title should not be empty'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=emails?action=edit&id=" . $id);
             break;
         default:
             $this->_exportVariableToView("prefLocale", osc_current_admin_locale());
             $this->_exportVariableToView("emails", $this->emailManager->listAll(1));
             $this->doView("emails/index.php");
     }
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:49,代码来源:emails.php

示例4: __construct

 function __construct($install = false)
 {
     if (!$install) {
         // get user/admin locale
         if (OC_ADMIN) {
             $locale = osc_current_admin_locale();
         } else {
             $locale = osc_current_user_locale();
         }
         // load core
         $core_file = osc_translations_path() . $locale . '/core.mo';
         $this->_load($core_file, 'core');
         // load messages
         $messages_file = osc_themes_path() . osc_theme() . '/languages/' . $locale . '/messages.mo';
         if (!file_exists($messages_file)) {
             $messages_file = osc_translations_path() . $locale . '/messages.mo';
         }
         $this->_load($messages_file, 'messages');
         // load theme
         $domain = osc_theme();
         $theme_file = osc_themes_path() . $domain . '/languages/' . $locale . '/theme.mo';
         if (!file_exists($theme_file)) {
             if (!file_exists(osc_themes_path() . $domain)) {
                 $domain = 'modern';
             }
             $theme_file = osc_translations_path() . $locale . '/theme.mo';
         }
         $this->_load($theme_file, $domain);
         // load plugins
         $aPlugins = Plugins::listInstalled();
         foreach ($aPlugins as $plugin) {
             $domain = preg_replace('|/.*|', '', $plugin);
             $plugin_file = osc_plugins_path() . $domain . '/languages/' . $locale . '/messages.mo';
             if (file_exists($plugin_file)) {
                 $this->_load($plugin_file, $domain);
             }
         }
     } else {
         $core_file = osc_translations_path() . osc_current_admin_locale() . '/core.mo';
         $this->_load($core_file, 'core');
     }
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:42,代码来源:Translation.php

示例5: __construct

 /**
  *
  */
 function __construct($expired = false)
 {
     parent::__construct();
     $this->setTableName('t_item');
     $this->setFields(array('pk_i_id'));
     $this->withPattern = false;
     $this->withLocations = false;
     $this->withCategoryId = false;
     $this->withUserId = false;
     $this->withPicture = false;
     $this->withNoUserEmail = false;
     $this->price_min = null;
     $this->price_max = null;
     $this->user_ids = null;
     $this->itemId = null;
     $this->city_areas = array();
     $this->cities = array();
     $this->regions = array();
     $this->countries = array();
     $this->categories = array();
     $this->conditions = array();
     $this->tables = array();
     $this->tables_join = array();
     $this->search_fields = array();
     $this->itemConditions = array();
     $this->groupBy = '';
     $this->having = '';
     $this->order();
     $this->limit();
     $this->results_per_page = 10;
     if (!$expired) {
         // t_item
         $this->addItemConditions(sprintf("%st_item.b_enabled = 1 ", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("%st_item.b_active = 1 ", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("%st_item.b_spam = 0", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("(%st_item.b_premium = 1 || %st_item.dt_expiration >= '%s')", DB_TABLE_PREFIX, DB_TABLE_PREFIX, date('Y-m-d H:i:s')));
     }
     $this->total_results = null;
     $this->total_results_table = null;
     // get all item_location data
     if (OC_ADMIN) {
         $this->addField(sprintf('%st_item_location.*', DB_TABLE_PREFIX));
         $this->locale_code = osc_current_admin_locale();
     } else {
         $this->locale_code = osc_current_user_locale();
     }
 }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:50,代码来源:Search.php

示例6: extendData

        /**
         * Extends the given array $items with description in available locales
         *
         * @access public
         * @since unknown
         * @param type $items
         * @return array with description extended with all available locales
         */
        public function extendData($items)
        {
            if( OC_ADMIN ) {
                $prefLocale = osc_current_admin_locale();
            } else {
                $prefLocale = osc_current_user_locale();
            }

            $results = array();

            foreach ($items as $item) {
                $this->dao->select();
                $this->dao->from(DB_TABLE_PREFIX.'t_item_description');
                $this->dao->where(DB_TABLE_PREFIX.'t_item_description.fk_i_item_id', $item['pk_i_id']);

                $result = $this->dao->get();
                $descriptions = $result->result();

                $item['locale'] = array();
                foreach ($descriptions as $desc) {
                    if ($desc['s_title'] != "" || $desc['s_description'] != "") {
                        $item['locale'][$desc['fk_c_locale_code']] = $desc;
                    }
                }
                if (isset($item['locale'][$prefLocale])) {
                    $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
                    $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
                } else {
                    $data = current($item['locale']);
                    $item['s_title'] = $data['s_title'];
                    $item['s_description'] = $data['s_description'];
                    unset($data);
                }

                // populate locations and category_name
                $this->dao->select(DB_TABLE_PREFIX.'t_item_location.*, cd.s_name as s_category_name');
                // select sum item_stats
                $this->dao->select('SUM(`s`.`i_num_views`) as `i_num_views`' );
                $this->dao->select('SUM(`s`.`i_num_spam`) as `i_num_spam`' );
                $this->dao->select('SUM(`s`.`i_num_bad_classified`) as `i_num_bad_classified`' );
                $this->dao->select('SUM(`s`.`i_num_repeated`) as `i_num_repeated`' );
                $this->dao->select('SUM(`s`.`i_num_offensive`) as `i_num_offensive`' );
                $this->dao->select('SUM(`s`.`i_num_expired`) as `i_num_expired` ' );
                $this->dao->select('SUM(`s`.`i_num_premium_views`) as `i_num_premium_views` ' );

                $this->dao->from(DB_TABLE_PREFIX.'t_item_location');
                $this->dao->from(DB_TABLE_PREFIX.'t_category_description as cd');
                $this->dao->from(DB_TABLE_PREFIX.'t_item_stats as s');
                $this->dao->where(DB_TABLE_PREFIX.'t_item_location.fk_i_item_id', $item['pk_i_id']);
//                $this->dao->where(DB_TABLE_PREFIX.'t_item_stats.fk_i_item_id', $item['pk_i_id']);
                $this->dao->where('s.fk_i_item_id', $item['pk_i_id']);
                $this->dao->where('cd.fk_i_category_id', $item['fk_i_category_id']);
                // group by item_id
                $this->dao->groupBy('fk_i_item_id');

                $result = $this->dao->get();
                $extraFields = $result->row();

                foreach($extraFields as $key => $value) {
                    $item[$key] = $value;
                }

                $results[] = $item;
            }
            return $results;
        }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:74,代码来源:Item.php

示例7: oc_install_example_data

function oc_install_example_data()
{
    require_once LIB_PATH . 'osclass/formatting.php';
    require LIB_PATH . 'osclass/installer/categories.php';
    require_once LIB_PATH . 'osclass/model/Category.php';
    $mCat = Category::newInstance();
    if (!function_exists('osc_apply_filter')) {
        function osc_apply_filter($dummyfilter, $str)
        {
            return $str;
        }
    }
    foreach ($categories as $category) {
        $fields['pk_i_id'] = $category['pk_i_id'];
        $fields['fk_i_parent_id'] = $category['fk_i_parent_id'];
        $fields['i_position'] = $category['i_position'];
        $fields['i_expiration_days'] = 0;
        $fields['b_enabled'] = 0;
        $aFieldsDescription[osc_current_admin_locale()]['s_name'] = $category['s_name'];
        $mCat->insert($fields, $aFieldsDescription);
    }
}
开发者ID:randomecho,项目名称:OSClass,代码行数:22,代码来源:install-functions.php

示例8: array

" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <script type="text/javascript">
        var osc = window.osc || {};
<?php 
/* TODO: enqueue js lang strings */
$lang = array('no_subcategory' => __('No Subcategory'), 'select_subcategory' => __('Select Subcategory'));
$locales = osc_get_locales();
$codes = array();
foreach ($locales as $locale) {
    $codes[] = '\'' . osc_esc_js($locale['pk_c_code']) . '\'';
}
?>
        osc.locales = {};
        osc.locales.current = '<?php 
echo osc_current_admin_locale();
?>
';
        osc.locales.codes   = new Array(<?php 
echo join(',', $codes);
?>
);
        osc.locales.string  = '[name*="' + osc.locales.codes.join('"],[name*="') + '"],.' + osc.locales.codes.join(',.');
        osc.langs = <?php 
echo json_encode($lang);
?>
;
    </script>
    <?php 
osc_run_hook('admin_header');
?>
开发者ID:jmcclenon,项目名称:Osclass,代码行数:31,代码来源:header.php

示例9: doModel


//.........这里部分代码省略.........
             } else {
                 osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages?action=edit&id=" . $id);
             break;
         case 'add':
             $this->_exportVariableToView("page", array());
             $this->doView("pages/frm.php");
             break;
         case 'add_post':
             // setForm just in case the form fails
             foreach (Params::getParamsAsArray('', false) as $k => $v) {
                 Session::newInstance()->_setForm($k, $v);
             }
             $s_internal_name = Params::getParam("s_internal_name");
             // sanitize internal name
             $s_internal_name = osc_sanitizeString($s_internal_name);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             $page = $this->pageManager->findByInternalName($s_internal_name);
             if (!isset($page['pk_i_id'])) {
                 $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0');
                 $aFieldsDescription = array();
                 $postParams = Params::getParamsAsArray('', false);
                 $not_empty = false;
                 foreach ($postParams as $k => $v) {
                     if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                         if ($m[2] == 's_title' && $v != '') {
                             $not_empty = true;
                         }
                         $aFieldsDescription[$m[1]][$m[2]] = $v;
                     }
                 }
                 if ($not_empty) {
                     $result = $this->pageManager->insert($aFields, $aFieldsDescription);
                     osc_add_flash_ok_message(_m('The page has been added'), 'admin');
                 } else {
                     osc_add_flash_error_message(_m("The page couldn't be added, at least one title should not be empty"), 'admin');
                 }
             } else {
                 osc_add_flash_error_message(_m("Oops! That internal name is already in use. We can't made the changes"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             break;
         case 'delete':
             $id = Params::getParam("id");
             $page_deleted_correcty = 0;
             $page_deleted_error = 0;
             $page_indelible = 0;
             if (!is_array($id)) {
                 $id = array($id);
             }
             foreach ($id as $_id) {
                 $result = (int) $this->pageManager->deleteByPrimaryKey($_id);
                 switch ($result) {
                     case -1:
                         $page_indelible++;
                         break;
                     case 0:
                         $page_deleted_error++;
                         break;
                     case 1:
                         $page_deleted_correcty++;
                 }
             }
             if ($page_indelible > 0) {
                 if ($page_indelible == 1) {
                     osc_add_flash_error_message(_m("One page can't be deleted because it is indelible"), 'admin');
                 } else {
                     osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted because are indelible"), $page_indelible), 'admin');
                 }
             }
             if ($page_deleted_error > 0) {
                 if ($page_deleted_error == 1) {
                     osc_add_flash_error_message(_m("One page couldn't be deleted"), 'admin');
                 } else {
                     osc_add_flash_error_message(sprintf(_m("%s pages couldn't be deleted"), $page_deleted_error), 'admin');
                 }
             }
             if ($page_deleted_correcty > 0) {
                 if ($page_deleted_correcty == 1) {
                     osc_add_flash_ok_message(_m('One page has been deleted correctly'), 'admin');
                 } else {
                     osc_add_flash_ok_message(sprintf(_m('%s pages have been deleted correctly'), $page_deleted_correcty), 'admin');
                 }
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             break;
         default:
             $this->_exportVariableToView("prefLocale", osc_current_admin_locale());
             $this->_exportVariableToView("pages", $this->pageManager->listAll(0));
             $this->doView("pages/index.php");
     }
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:101,代码来源:pages.php

示例10: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'edit':
             if (Params::getParam("id") == '') {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=emails");
             }
             $form = count(Session::newInstance()->_getForm());
             $keepForm = count(Session::newInstance()->_getKeepForm());
             if ($form == 0 || $form == $keepForm) {
                 Session::newInstance()->_dropKeepForm();
             }
             $this->_exportVariableToView("email", $this->emailManager->findByPrimaryKey(Params::getParam("id")));
             $this->doView("emails/frm.php");
             break;
         case 'edit_post':
             osc_csrf_check();
             $id = Params::getParam("id");
             $s_internal_name = Params::getParam("s_internal_name");
             $aFieldsDescription = array();
             $postParams = Params::getParamsAsArray('', false);
             $not_empty = false;
             foreach ($postParams as $k => $v) {
                 if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                     if ($m[2] == 's_title' && $v != '') {
                         $not_empty = true;
                     }
                     $aFieldsDescription[$m[1]][$m[2]] = $v;
                 }
             }
             Session::newInstance()->_setForm('s_internal_name', $s_internal_name);
             Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription);
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->emailManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->emailManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->emailManager->isIndelible($id)) {
                         $this->emailManager->updateInternalName($id, $s_internal_name);
                     }
                     Session::newInstance()->_clearVariables();
                     osc_add_flash_ok_message(_m('The email/alert has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=emails");
                 }
                 osc_add_flash_error_message(_m('You can\'t repeat internal name'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('The email couldn\'t be updated, at least one title should not be empty'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=emails&action=edit&id=" . $id);
             break;
         default:
             //-
             if (Params::getParam('iDisplayLength') == '') {
                 Params::setParam('iDisplayLength', 10);
             }
             $p_iPage = 1;
             if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1) {
                 $p_iPage = Params::getParam('iPage');
             }
             Params::setParam('iPage', $p_iPage);
             $prefLocale = osc_current_admin_locale();
             $emails = $this->emailManager->listAll(1);
             // pagination
             $start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
             $limit = Params::getParam('iDisplayLength');
             $count = count($emails);
             $displayRecords = $limit;
             if ($start + $limit > $count) {
                 $displayRecords = $start + $limit - $count;
             }
             // ----
             $aData = array();
             $max = $start + $limit;
             if ($max > $count) {
                 $max = $count;
             }
             for ($i = $start; $i < $max; $i++) {
                 $email = $emails[$i];
                 if (isset($email['locale'][$prefLocale]) && !empty($email['locale'][$prefLocale]['s_title'])) {
                     $title = $email['locale'][$prefLocale];
                 } else {
                     $title = current($email['locale']);
                 }
                 $options = array();
                 $options[] = '<a href="' . osc_admin_base_url(true) . '?page=emails&amp;action=edit&amp;id=' . $email["pk_i_id"] . '">' . __('Edit') . '</a>';
                 $auxOptions = '<ul>' . PHP_EOL;
                 foreach ($options as $actual) {
                     $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
                 }
                 $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
                 $row = array();
                 $row[] = $email['s_internal_name'] . $actions;
                 $row[] = $title['s_title'];
                 $aData[] = $row;
             }
             // ----
             $array['iTotalRecords'] = $displayRecords;
             $array['iTotalDisplayRecords'] = count($emails);
//.........这里部分代码省略.........
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:emails.php

示例11: oc_install_example_data

function oc_install_example_data()
{
    require_once LIB_PATH . 'osclass/formatting.php';
    require LIB_PATH . 'osclass/installer/basic_data.php';
    require_once LIB_PATH . 'osclass/model/Category.php';
    $mCat = Category::newInstance();
    if (!function_exists('osc_apply_filter')) {
        function osc_apply_filter($dummyfilter, $str)
        {
            return $str;
        }
    }
    foreach ($categories as $category) {
        $fields['pk_i_id'] = $category['pk_i_id'];
        $fields['fk_i_parent_id'] = $category['fk_i_parent_id'];
        $fields['i_position'] = $category['i_position'];
        $fields['i_expiration_days'] = 0;
        $fields['b_enabled'] = 1;
        $aFieldsDescription[osc_current_admin_locale()]['s_name'] = $category['s_name'];
        $mCat->insert($fields, $aFieldsDescription);
    }
    require_once LIB_PATH . 'osclass/model/Item.php';
    require_once LIB_PATH . 'osclass/model/ItemComment.php';
    require_once LIB_PATH . 'osclass/model/ItemLocation.php';
    require_once LIB_PATH . 'osclass/model/ItemResource.php';
    require_once LIB_PATH . 'osclass/model/ItemStats.php';
    require_once LIB_PATH . 'osclass/model/User.php';
    require_once LIB_PATH . 'osclass/model/Country.php';
    require_once LIB_PATH . 'osclass/model/Region.php';
    require_once LIB_PATH . 'osclass/model/City.php';
    require_once LIB_PATH . 'osclass/model/CityArea.php';
    require_once LIB_PATH . 'osclass/model/Field.php';
    require_once LIB_PATH . 'osclass/model/Page.php';
    require_once LIB_PATH . 'osclass/model/Log.php';
    require_once LIB_PATH . 'osclass/model/CategoryStats.php';
    require_once LIB_PATH . 'osclass/model/CountryStats.php';
    require_once LIB_PATH . 'osclass/model/RegionStats.php';
    require_once LIB_PATH . 'osclass/model/CityStats.php';
    require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
    require_once LIB_PATH . 'osclass/helpers/hValidate.php';
    require_once LIB_PATH . 'osclass/helpers/hUsers.php';
    require_once LIB_PATH . 'osclass/ItemActions.php';
    $mItem = new ItemActions(true);
    foreach ($item as $k => $v) {
        if ($k == 'description' || $k == 'title') {
            Params::setParam($k, array(osc_current_admin_locale() => $v));
        } else {
            Params::setParam($k, $v);
        }
    }
    $mItem->prepareData(true);
    $successItem = $mItem->add();
    $successPageresult = Page::newInstance()->insert(array('s_internal_name' => $page['s_internal_name'], 'b_indelible' => 0, 's_meta' => json_encode('')), array(osc_current_admin_locale() => array('s_title' => $page['s_title'], 's_text' => $page['s_text'])));
}
开发者ID:mylastof,项目名称:os-class,代码行数:54,代码来源:install-functions.php

示例12: _makeSQL

 /**
  * Make the SQL for the search with all the conditions and filters specified
  *
  * @access private
  * @since unknown
  * @param bool $count
  */
 private function _makeSQL($count = false, $premium = false)
 {
     $arrayConditions = $this->_conditions();
     $extraFields = $arrayConditions['extraFields'];
     $conditionsSQL = $arrayConditions['conditionsSQL'];
     $sql = '';
     if ($this->withItemId) {
         // add field s_user_name
         $this->dao->select(sprintf('%st_item.*, %st_item.s_contact_name as s_user_name', DB_TABLE_PREFIX, DB_TABLE_PREFIX));
         $this->dao->from(sprintf('%st_item', DB_TABLE_PREFIX));
         $this->dao->where('pk_i_id', (int) $this->itemId);
     } else {
         if ($count) {
             $this->dao->select(DB_TABLE_PREFIX . 't_item.pk_i_id');
             $this->dao->select($extraFields);
             // plugins!
         } else {
             $this->dao->select(DB_TABLE_PREFIX . 't_item.*, ' . DB_TABLE_PREFIX . 't_item.s_contact_name as s_user_name');
             $this->dao->select($extraFields);
             // plugins!
         }
         $this->dao->from(DB_TABLE_PREFIX . 't_item');
         if ($this->withNoUserEmail) {
             $this->dao->where(DB_TABLE_PREFIX . 't_item.s_contact_email', $this->sEmail);
         }
         if ($this->withPattern) {
             $this->dao->join(DB_TABLE_PREFIX . 't_item_description as d', 'd.fk_i_item_id = ' . DB_TABLE_PREFIX . 't_item.pk_i_id', 'LEFT');
             $this->dao->where(sprintf("MATCH(d.s_title, d.s_description) AGAINST('%s' IN BOOLEAN MODE)", $this->sPattern));
             if (empty($this->locale_code)) {
                 if (OC_ADMIN) {
                     $this->locale_code[osc_current_admin_locale()] = osc_current_admin_locale();
                 } else {
                     $this->locale_code[osc_current_user_locale()] = osc_current_user_locale();
                 }
             }
             $this->dao->where(sprintf("( d.fk_c_locale_code LIKE '%s' )", implode("' d.fk_c_locale_code LIKE '", $this->locale_code)));
         }
         // item conditions
         if (count($this->itemConditions) > 0) {
             $itemConditions = implode(' AND ', osc_apply_filter('sql_search_item_conditions', $this->itemConditions));
             $this->dao->where($itemConditions);
         }
         if ($this->withCategoryId && count($this->categories) > 0) {
             $this->dao->where(sprintf("%st_item.fk_i_category_id", DB_TABLE_PREFIX) . ' IN (' . implode(', ', $this->categories) . ')');
         }
         if ($this->withUserId) {
             $this->_fromUser();
         }
         if ($this->withLocations || OC_ADMIN) {
             $this->dao->join(sprintf('%st_item_location', DB_TABLE_PREFIX), sprintf('%st_item_location.fk_i_item_id = %st_item.pk_i_id', DB_TABLE_PREFIX, DB_TABLE_PREFIX), 'LEFT');
             $this->_addLocations();
         }
         if ($this->withPicture) {
             $this->dao->join(sprintf('%st_item_resource', DB_TABLE_PREFIX), sprintf('%st_item_resource.fk_i_item_id = %st_item.pk_i_id', DB_TABLE_PREFIX, DB_TABLE_PREFIX), 'LEFT');
             $this->dao->where(sprintf("%st_item_resource.s_content_type LIKE '%%image%%' ", DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX));
             $this->dao->groupBy(DB_TABLE_PREFIX . 't_item.pk_i_id');
         }
         if ($this->onlyPremium) {
             $this->dao->where(sprintf("%st_item.b_premium = 1", DB_TABLE_PREFIX));
         }
         $this->_priceRange();
         // add joinTables
         $this->_joinTable();
         // PLUGINS TABLES !!
         if (!empty($this->tables)) {
             $tables = implode(', ', $this->tables);
             $this->dao->from($tables);
         }
         // WHERE PLUGINS extra conditions
         if (count($this->conditions) > 0) {
             $this->dao->where($conditionsSQL);
         }
         // ---------------------------------------------------------
         // groupBy
         if ($this->groupBy != '') {
             $this->dao->groupBy($this->groupBy);
         }
         // having
         if ($this->having != '') {
             $this->dao->having($this->having);
         }
         // ---------------------------------------------------------
         // order & limit
         $this->dao->orderBy($this->order_column, $this->order_direction);
         if ($count) {
             $this->dao->limit(100 * $this->results_per_page);
         } else {
             $this->dao->limit($this->limit_init, $this->results_per_page);
         }
     }
     $this->sql = $this->dao->_getSelect();
     // reset dao attributes
     $this->dao->_resetSelect();
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:Search.php

示例13: extendData

 /**
  * Extends the given array $items with description in available locales
  *
  * @access public
  * @since unknown
  * @param type $items
  * @return array with description extended with all available locales 
  */
 public function extendData($items)
 {
     if (OC_ADMIN) {
         $prefLocale = osc_current_admin_locale();
     } else {
         $prefLocale = osc_current_user_locale();
     }
     $results = array();
     foreach ($items as $item) {
         $this->dao->select();
         $this->dao->from(DB_TABLE_PREFIX . 't_item_description');
         $this->dao->where(DB_TABLE_PREFIX . 't_item_description.fk_i_item_id', $item['pk_i_id']);
         $result = $this->dao->get();
         $descriptions = $result->result();
         $item['locale'] = array();
         foreach ($descriptions as $desc) {
             if ($desc['s_title'] != "" || $desc['s_description'] != "") {
                 $item['locale'][$desc['fk_c_locale_code']] = $desc;
             }
         }
         if (isset($item['locale'][$prefLocale])) {
             $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
             $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
         } else {
             $data = current($item['locale']);
             $item['s_title'] = $data['s_title'];
             $item['s_description'] = $data['s_description'];
             unset($data);
         }
         // populate locations and category_name
         $this->dao->select(DB_TABLE_PREFIX . 't_item_location.*, ' . DB_TABLE_PREFIX . 't_item_stats.*, cd.s_name as s_category_name');
         $this->dao->from(DB_TABLE_PREFIX . 't_item_location');
         $this->dao->from(DB_TABLE_PREFIX . 't_category_description as cd');
         $this->dao->from(DB_TABLE_PREFIX . 't_item_stats');
         $this->dao->where(DB_TABLE_PREFIX . 't_item_location.fk_i_item_id', $item['pk_i_id']);
         $this->dao->where(DB_TABLE_PREFIX . 't_item_stats.fk_i_item_id', $item['pk_i_id']);
         $this->dao->where('cd.fk_i_category_id', $item['fk_i_category_id']);
         $result = $this->dao->get();
         $extraFields = $result->row();
         foreach ($extraFields as $key => $value) {
             $item[$key] = $value;
         }
         $results[] = $item;
     }
     return $results;
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:54,代码来源:Item.php

示例14: extendData

 /**
  * Extends the given array $items with description in available locales
  *
  * @access public
  * @since unknown
  * @param type $items
  * @return array with description extended with all available locales 
  */
 public function extendData($items)
 {
     if (defined('OC_ADMIN')) {
         $prefLocale = osc_current_admin_locale();
     } else {
         $prefLocale = osc_current_user_locale();
     }
     $results = array();
     foreach ($items as $item) {
         $this->dao->select();
         $this->dao->from(DB_TABLE_PREFIX . 't_item_description');
         $this->dao->where('fk_i_item_id', $item['pk_i_id']);
         $result = $this->dao->get();
         $descriptions = $result->result();
         $item['locale'] = array();
         foreach ($descriptions as $desc) {
             if ($desc['s_title'] != "" || $desc['s_description'] != "") {
                 $item['locale'][$desc['fk_c_locale_code']] = $desc;
             }
         }
         if (isset($item['locale'][$prefLocale])) {
             $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
             $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
             $item['s_what'] = $item['locale'][$prefLocale]['s_what'];
         } else {
             $data = current($item['locale']);
             $item['s_title'] = $data['s_title'];
             $item['s_description'] = $data['s_description'];
             $item['s_what'] = $data['s_what'];
             unset($data);
         }
         $results[] = $item;
     }
     return $results;
 }
开发者ID:acharei,项目名称:OSClass,代码行数:43,代码来源:Item.php

示例15: doModel


//.........这里部分代码省略.........
         case 'order_pages':
             $order = Params::getParam("order");
             $id = Params::getParam("id");
             $count = osc_count_static_pages();
             if ($order != '' && $id != '') {
                 $mPages = Page::newInstance();
                 $actual_page = $mPages->findByPrimaryKey($id);
                 $actual_order = $actual_page['i_order'];
                 $array = array();
                 $condition = array();
                 $new_order = $actual_order;
                 if ($order == 'up') {
                     if ($actual_order > 0) {
                         $new_order = $actual_order - 1;
                     }
                 } else {
                     if ($order == 'down') {
                         if ($actual_order != $count - 1) {
                             $new_order = $actual_order + 1;
                         }
                     }
                 }
                 if ($new_order != $actual_order) {
                     $auxpage = $mPages->findByOrder($new_order);
                     $array = array('i_order' => $actual_order);
                     $conditions = array('pk_i_id' => $auxpage['pk_i_id']);
                     $mPages->update($array, $conditions);
                     $array = array('i_order' => $new_order);
                     $conditions = array('pk_i_id' => $id);
                     $mPages->update($array, $conditions);
                 } else {
                 }
                 // json for datatables
                 $prefLocale = osc_current_admin_locale();
                 $aPages = $mPages->listAll(0);
                 $json = "[";
                 foreach ($aPages as $key => $page) {
                     $body = array();
                     if (isset($page['locale'][$prefLocale]) && !empty($page['locale'][$prefLocale]['s_title'])) {
                         $body = $page['locale'][$prefLocale];
                     } else {
                         $body = current($page['locale']);
                     }
                     $p_body = str_replace("'", "\\'", trim(strip_tags($body['s_title']), "\"'"));
                     $json .= "[\"<input type='checkbox' name='id[]' value='" . $page['pk_i_id'] . "' />\",";
                     $json .= "\"" . $page['s_internal_name'] . "<div id='datatables_quick_edit'>";
                     $json .= "<a href='" . osc_static_page_url() . "'>" . __('View page') . "</a> | ";
                     $json .= "<a href='" . osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $page['pk_i_id'] . "'>";
                     $json .= __('Edit') . "</a>";
                     if (!$page['b_indelible']) {
                         $json .= " | ";
                         $json .= "<a onclick=\\\"javascript:return confirm('";
                         $json .= __('This action can\\\\\'t be undone. Are you sure you want to continue?') . "')\\\" ";
                         $json .= " href='" . osc_admin_base_url(true) . "?page=pages&action=delete&id=" . $page['pk_i_id'] . "'>";
                         $json .= __('Delete') . "</a>";
                     }
                     $json .= "</div>\",";
                     $json .= "\"" . $p_body . "\",";
                     $json .= "\"<img id='up' onclick='order_up(" . $page['pk_i_id'] . ");' style='cursor:pointer;width:15;height:15px;' src='" . osc_current_admin_theme_url('images/arrow_up.png') . "'/> <br/> <img id='down' onclick='order_down(" . $page['pk_i_id'] . ");' style='cursor:pointer;width:15;height:15px;' src='" . osc_current_admin_theme_url('images/arrow_down.png') . "'/>\"]";
                     if ($key != count($aPages) - 1) {
                         $json .= ',';
                     } else {
                         $json .= '';
                     }
                 }
                 $json .= "]";
开发者ID:nsswaga,项目名称:OSClass,代码行数:67,代码来源:ajax.php


注:本文中的osc_current_admin_locale函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。