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


PHP ContentModel::get_models_by_cache方法代码示例

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


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

示例1: actionUpdate

 /**
  * 更新档案栏目
  * @param mixed $id
  */
 public function actionUpdate($id)
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (!isset($_POST['Class']) || !is_array($_POST['Class'])) {
             $this->redirect[] = array('text' => '', 'href' => 'javascript:history.go(-1);');
             $this->message('保存档案栏目信息错误', self::MSG_ERROR, true);
         }
         if ($_POST['Class']['class_name'] == '') {
             $this->redirect[] = array('text' => '', 'href' => 'javascript:history.go(-1);');
             $this->message('档案栏目名称不能为空', self::MSG_ERROR, true);
         }
         if ($_POST['Class']['content_model_id'] == '') {
             $this->redirect[] = array('text' => '', 'href' => 'javascript:history.go(-1);');
             $this->message('内容模型不能为空', self::MSG_ERROR, true);
         }
         if (empty($_POST['Class']['class_identify'])) {
             $this->redirect[] = array('text' => '', 'href' => 'javascript:history.go(-1);');
             $this->message('档案栏目标识不能为空', self::MSG_ERROR, true);
         }
         $flag = $this->db->update('{{content_archives_classes}}', array('class_name' => $_POST['Class']['class_name'], 'content_model_id' => $_POST['Class']['content_model_id'], 'class_identify' => $_POST['Class']['class_identify'], 'class_is_default' => isset($_POST['Class']['class_is_default']) ? intval($_POST['Class']['class_is_default']) : 0, 'class_default' => $_POST['Class']['class_default'], 'class_is_part' => isset($_POST['Class']['class_is_part']) ? intval($_POST['Class']['class_is_part']) : ContentArchivesClass::STAT_PART_COVER_CLASS, 'class_tempindex' => $_POST['Class']['class_tempindex'], 'class_templist' => $_POST['Class']['class_templist'], 'class_temparticle' => $_POST['Class']['class_temparticle'], 'class_seo_keywords' => $_POST['Class']['class_seo_keywords'], 'class_seo_description' => $_POST['Class']['class_seo_description'], 'class_is_show' => isset($_POST['Class']['class_is_show']) ? intval($_POST['Class']['class_is_show']) : 0, 'class_rank' => isset($_POST['Class']['class_rank']) ? intval($_POST['Class']['class_rank']) : 255, 'class_lasttime' => $_SERVER['REQUEST_TIME']), 'class_id=:class_id', array(':class_id' => $id));
         if ($flag) {
             $class_name = $_POST['Class']['class_name'];
             //更新缓存
             ContentArchivesClass::update_cache();
             //记录操作日志
             $user = $this->user;
             $message = '{user_name}修改了档案栏目({classes_name})信息';
             $data = array('user_id' => $user->id, 'user_name' => $user->name, 'classes_name' => $class_name, 'data' => array('content_model_id' => $id));
             AdminLogs::add($user->id, 'Content/Class', $id, 'Modify', 'success', $message, $data);
             if (!isset($_GET['ajax'])) {
                 $this->redirect[] = array('text' => '', 'href' => url($this->module->id . '/Content/Class/Index' . ($page ? '/' . $page : '')));
                 $this->message('保存档案栏目成功', self::MSG_SUCCESS, true);
             }
         } else {
             //记录操作日志
             $user = $this->user;
             $message = '{user_name}修改档案栏目({classes_name})信息失败';
             $data = array('user_id' => $user->id, 'user_name' => $user->name, 'classes_name' => $class_name, 'data' => array('server' => $_POST['Class']));
             AdminLogs::add($user->id, 'Content/Class', $id, 'Modify', 'failure', $message, $data);
             $this->redirect[] = array('text' => '', 'href' => 'javascript:history.go(-1);');
             $this->message('保存档案栏目信息失败', self::MSG_ERROR, true);
         }
     }
     $class = ContentArchivesClass::get_class_by_id($id, false);
     if (empty($class)) {
         $this->redirect[] = array('text' => '', 'href' => url($this->module->id . '/Content/Class/Index'));
         $this->message('档案栏目不存在或已被删除', self::MSG_ERROR, true);
     }
     //
     $models = ContentModel::get_models_by_cache();
     $this->render('update', array('class' => $class, 'models' => $models));
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:56,代码来源:Class.php

示例2: actionIndex

 /**
  * 文档管理
  */
 public function actionIndex($content_model_id = null, $class_id = null, $search_key = null, $page = null)
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         //保存修改
         if (!is_array($_POST['Archive']['content_archives_rank'])) {
             $_POST['Archive']['content_archives_rank'] = array();
         }
         foreach ($_POST['Archive']['content_archives_rank'] as $_k => $_v) {
             $flag = Yii::app()->db->createCommand()->update('{{content_model}}', array('content_archives_rank' => $_POST['Archive']['content_archives_rank'][$_k] ? intval($_POST['Archive']['content_archives_rank'][$_k]) : 255, 'content_archives_lasttime' => $_SERVER['REQUEST_TIME']), 'content_archives_id=:content_archives_id', array(':content_archives_id' => $_k));
             if ($flag) {
                 //记录操作日志
                 $message = '{user_name}修改了文档({archive_subject})信息';
                 $data = array('user_id' => Yii::app()->user->id, 'user_name' => Yii::app()->user->name, 'archive_subject' => $_v, 'data' => $_POST);
                 AdminLogs::add(Yii::app()->user->id, 'Content/Archive', $_k, 'Modify', 'success', $message, $data);
             }
         }
         //$this->refresh();
         $this->redirect[] = array('text' => '', 'href' => $this->forward ? $this->forward : url($this->module->id . '/Content/Archives/Index'));
         $this->message('修改文档完成', self::MSG_SUCCESS, true);
     }
     $params = array('allow_cache' => false, 'content_model_id' => $content_model_id, 'class_id' => $class_id ? $class_id : 2, 'search_key' => $search_key);
     $_model = ContentModel::get_model_by_id($content_model_id);
     $_list_template = $_model['content_model_list_template'] ? $_model['content_model_list_template'] : 'default';
     $this->render("_{$_list_template}_list", array('content_model_id' => $content_model_id, 'class_id' => $class_id, 'archives' => ContentArchives::Pages($params), 'models' => ContentModel::get_models_by_cache(), 'classes' => ContentArchivesClass::get_classes_by_cache()));
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:28,代码来源:ArchivesController.php


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