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


PHP cmsModel类代码示例

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


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

示例1: run

 public function run($controller_name)
 {
     if (!$controller_name) {
         cmsCore::error404();
     }
     $controller_info = $this->model->getControllerInfo($controller_name);
     if (!$controller_info || !$controller_info['is_external']) {
         cmsCore::error404();
     }
     if ($controller_info['is_backend']) {
         $backend_context = $this->request->isAjax() ? cmsRequest::CTX_AJAX : cmsRequest::CTX_INTERNAL;
         $backend_request = new cmsRequest($this->request->getData(), $backend_context);
         $backend_controller = $this->loadControllerBackend($controller_info['name'], $backend_request);
         // смотрим специальный экшен
         if ($backend_controller->isActionExists('delete_component')) {
             $backend_controller->redirectToAction('delete_component');
         }
     }
     // нет бэкэенда или экшена, удаляем через метод модели контроллера
     // если в модели контроллера нет метода deleteController
     // будет использоваться из основной модели
     // который просто удалит запись в cms_controllers
     if (cmsCore::isModelExists($controller_info['name'])) {
         cmsCore::getModel($controller_info['name'])->deleteController($controller_info['id']);
     } else {
         $model = new cmsModel();
         $model->deleteController($controller_info['id']);
     }
     cmsUser::addSessionMessage(sprintf(LANG_CP_COMPONENT_IS_DELETED, $controller_info['title']), 'success');
     $this->redirectToAction('controllers');
 }
开发者ID:pin-git,项目名称:icms2,代码行数:31,代码来源:controllers_delete.php

示例2: getLocationTypeValue

 private function getLocationTypeValue($id, $location_type)
 {
     $model = new cmsModel();
     $item_name = $model->getField('geo_' . $location_type, $id, 'name');
     if ($item_name) {
         return $item_name;
     }
     return null;
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:9,代码来源:city.php

示例3: add_perms

function add_perms($data, $type, $options = null)
{
    $model = new cmsModel();
    foreach ($data as $controller => $names) {
        foreach ($names as $name) {
            if (!$model->db->getRowsCount('perms_rules', "controller = '{$controller}' AND name = '{$name}'", 1)) {
                $model->insert('perms_rules', array('controller' => $controller, 'name' => $name, 'type' => $type, 'options' => $options));
            }
        }
    }
}
开发者ID:Val-Git,项目名称:icms2,代码行数:11,代码来源:install.php

示例4: run

 public function run($id)
 {
     if (!$id) {
         cmsCore::error404();
     }
     $content_model = cmsCore::getModel('content');
     $ctype = $content_model->getContentType($id);
     $ctype = cmsEventsManager::hook("ctype_before_delete", $ctype);
     $content_model->deleteContentType($id);
     cmsEventsManager::hook("ctype_after_delete", $ctype);
     cmsCore::getModel('widgets')->deletePagesByName('content', "{$ctype['name']}.*");
     $binded_widgets = $content_model->get('widgets_bind', function ($item, $model) {
         $item['options'] = cmsModel::yamlToArray($item['options']);
         return $item;
     });
     if ($binded_widgets) {
         foreach ($binded_widgets as $widget) {
             if (isset($widget['options']['ctype_id']) && $ctype['id'] == $widget['options']['ctype_id']) {
                 $content_model->delete('widgets_bind', $widget['id']);
             }
         }
     }
     cmsCore::getController('activity')->deleteType('content', "add.{$ctype['name']}");
     $this->redirectToAction('ctypes');
 }
开发者ID:asphix,项目名称:icms2,代码行数:25,代码来源:ctypes_delete.php

示例5: getPresetByName

 public function getPresetByName($name)
 {
     return $this->getItemByField('images_presets', 'name', $name, function ($item, $model) {
         $item['wm_image'] = cmsModel::yamlToArray($item['wm_image']);
         return $item;
     });
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:model.php

示例6: store

 public function store($value, $is_submitted, $old_value = null)
 {
     $config = cmsConfig::getInstance();
     $files_model = cmsCore::getModel('files');
     if ($value) {
         $file = cmsModel::yamlToArray($old_value);
         $path = $config->upload_path . $file['path'];
         @unlink($path);
         $files_model->deleteFile($file['id']);
         $old_value = null;
     }
     $uploader = new cmsUploader();
     if (!$uploader->isUploaded($this->name)) {
         return $old_value;
     }
     $allowed_extensions = $this->getOption('extensions');
     $max_size_mb = $this->getOption('max_size_mb');
     if (!trim($allowed_extensions)) {
         $allowed_extensions = false;
     }
     if (!$max_size_mb) {
         $max_size_mb = 0;
     }
     $result = $uploader->upload($this->name, $allowed_extensions, $max_size_mb * 1048576);
     if (!$result['success']) {
         if (!empty($result['path'])) {
             $uploader->remove($result['path']);
         }
         cmsUser::addSessionMessage($result['error'], 'error');
         return null;
     }
     $file = $files_model->registerFile($result['url'], $result['name']);
     return array('id' => $file['id'], 'url_key' => $file['url_key'], 'name' => $result['name'], 'size' => $result['size'], 'path' => $result['url']);
 }
开发者ID:asphix,项目名称:icms2,代码行数:34,代码来源:file.php

示例7: getControllerInfo

 public function getControllerInfo($controller_name)
 {
     return $this->getItemByField('controllers', 'name', $controller_name, function ($item) {
         $item['options'] = cmsModel::yamlToArray($item['options']);
         return $item;
     });
 }
开发者ID:rookees,项目名称:icms2,代码行数:7,代码来源:model.php

示例8: routeAction

 public function routeAction($action_name)
 {
     if (!is_numeric($action_name)) {
         return $action_name;
     }
     $this->lock_explicit_call = false;
     $group_id = $action_name;
     $group = $this->model->getGroup($group_id);
     if (!$group) {
         cmsCore::error404();
     }
     // кешируем запись для получения ее в виджетах
     cmsModel::cacheResult('current_group', $group);
     cmsModel::cacheResult('group_model', $this->model);
     $this->current_params = $this->cms_core->uri_params;
     $this->current_params[0] = $group;
     $membership = $this->model->getMembership($group['id'], $this->cms_user->id);
     $is_member = $membership !== false;
     if ($group['is_closed'] && !$is_member && !$this->cms_user->is_admin && (empty($this->cms_core->uri_params[0]) || $this->cms_core->uri_params[0] != 'join')) {
         return 'group_closed';
     }
     if (!$this->cms_core->uri_params) {
         return 'group';
     }
     $action_name = $this->cms_core->uri_params[0];
     $action_name = 'group_' . $action_name;
     return $action_name;
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:28,代码来源:frontend.php

示例9: getControllerInfo

 public function getControllerInfo($controller_name)
 {
     return $this->getItemByField('controllers', 'name', $controller_name, function ($item) {
         $item['options'] = cmsModel::yamlToArray($item['options']);
         $item['title'] = string_lang($item['name'] . '_CONTROLLER', $item['title']);
         return $item;
     });
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:8,代码来源:model.php

示例10: getFeedByCtypeName

 public function getFeedByCtypeName($ctype_name)
 {
     return $this->filterEqual('ctype_name', $ctype_name)->getItem('rss_feeds', function ($item, $model) {
         $item['mapping'] = cmsModel::yamlToArray($item['mapping']);
         $item['image'] = cmsModel::yamlToArray($item['image']);
         return $item;
     });
 }
开发者ID:asphix,项目名称:icms2,代码行数:8,代码来源:model.php

示例11: feed

 private function feed()
 {
     return $this->getItem('rss_feeds', function ($item, $model) {
         $item['mapping'] = cmsModel::yamlToArray($item['mapping']);
         $item['image'] = cmsModel::yamlToArray($item['image']);
         return $item;
     });
 }
开发者ID:pin-git,项目名称:icms2,代码行数:8,代码来源:model.php

示例12: getPhoto

 public function getPhoto($id)
 {
     $this->select('u.nickname', 'user_nickname');
     $this->select('u.avatar', 'user_avatar');
     $this->join('{users}', 'u', 'u.id = i.user_id');
     return $this->getItemById('photos', $id, function ($item, $model) {
         $item['user'] = array('id' => $item['user_id'], 'nickname' => $item['user_nickname'], 'avatar' => $item['user_avatar']);
         $item['image'] = cmsModel::yamlToArray($item['image']);
         return $item;
     });
 }
开发者ID:asphix,项目名称:icms2,代码行数:11,代码来源:model.php

示例13: getInput

 public function getInput($value)
 {
     $users_model = cmsCore::getModel('users');
     $items = $this->getProperty('show_all') ? array(0 => LANG_ALL) : array();
     $is_show_guests = (bool) $this->getProperty('show_guests');
     $groups = $users_model->getGroups($is_show_guests);
     foreach ($groups as $group) {
         $items[$group['id']] = $group['title'];
     }
     $this->data['groups'] = $items;
     if (!is_array($value)) {
         $value = cmsModel::yamlToArray($value);
     }
     return parent::getInput($value ? $value : array(0));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:15,代码来源:listgroups.php

示例14: deleteGroup

 public function deleteGroup($group)
 {
     $this->deleteGroupMemberships($group['id']);
     $this->deleteGroupInvites($group['id']);
     cmsCache::getInstance()->clean('groups.list');
     if ($group['logo']) {
         if (!is_array($group['logo'])) {
             $group['logo'] = cmsModel::yamlToArray($group['logo']);
         }
         $config = cmsConfig::getInstance();
         foreach ($group['logo'] as $image_url) {
             $image_path = $config->upload_path . $image_url;
             @unlink($image_path);
         }
     }
     return $this->delete('groups', $group['id']);
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:17,代码来源:model.php

示例15: run

 public function run()
 {
     $sources['photos'] = LANG_PHOTOS;
     // по каким полям поиск
     $match_fields['photos'] = array('title', 'content');
     // какие поля получать
     $select_fields['photos'] = array('id', 'content', 'image', 'slug', 'date_pub', 'title', 'rating', 'comments', 'user_id', 'sizes', 'hits_count');
     // из каких таблиц выборка
     $table_names['photos'] = 'photos';
     // получаем тут высоту строк, чтобы в шаблоне потом забрать
     $this->getRowHeight();
     return array('name' => $this->name, 'sources' => $sources, 'table_names' => $table_names, 'match_fields' => $match_fields, 'select_fields' => $select_fields, 'filters' => array('photos' => array()), 'item_callback' => function ($item, $model, $sources_name, $match_fields, $select_fields) {
         $item['image'] = cmsModel::yamlToArray($item['image']);
         $item['sizes'] = cmsModel::yamlToArray($item['sizes']);
         $item['title'] = strip_tags($item['title']);
         return $item;
     });
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:18,代码来源:fulltext_search.php


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