本文整理汇总了PHP中ContentModel::get_model_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentModel::get_model_by_id方法的具体用法?PHP ContentModel::get_model_by_id怎么用?PHP ContentModel::get_model_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentModel
的用法示例。
在下文中一共展示了ContentModel::get_model_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDisable
public function actionDisable($id)
{
$content_model = ContentModel::get_model_by_id($id);
Yii::app()->db->createCommand()->update('{{content_model}}', array('content_model_status' => ContentModel::STAT_ALLOW_NO), 'content_model_id=:content_model_id', array(':content_model_id' => $id));
//更新缓存
ContentModel::update_cache();
//记录操作日志
$user = Yii::app()->user;
$message = '{user_name}修改内容模型({model_name})状态为禁用';
$data = array('user_id' => $user->id, 'user_name' => $user->name, 'model_name' => $content_model['content_model_name'], 'addons_data' => array('server' => $_POST['Model']));
AdminLogs::add($user->id, 'Content/Model', $id, 'Modify', 'success', $message, $data);
if (!isset($_GET['ajax'])) {
$this->redirect[] = array('text' => '', 'href' => url($this->module->id . '/Content/Model/Index'));
$this->message('禁用内容模型完成', self::MSG_SUCCESS, true);
} else {
$_r = array('ok' => true);
echo json_encode($_r);
exit;
}
}
示例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()));
}