本文整理汇总了PHP中ContentModel::get_model_name_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentModel::get_model_name_by_id方法的具体用法?PHP ContentModel::get_model_name_by_id怎么用?PHP ContentModel::get_model_name_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentModel
的用法示例。
在下文中一共展示了ContentModel::get_model_name_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* 内容模型管理
*/
public function indexAction($page = null)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//保存修改
if (!is_array($_POST['Model']['content_model_rank'])) {
$_POST['Model']['content_model_rank'] = array();
}
foreach ($_POST['Model']['content_model_rank'] as $_k => $_v) {
$flag = Yii::app()->db->createCommand()->update('{{content_model}}', array('content_model_rank' => $_POST['Model']['content_model_rank'][$_k] ? intval($_POST['Model']['content_model_rank'][$_k]) : 255, 'content_model_lasttime' => $_SERVER['REQUEST_TIME']), 'content_model_id=:content_model_id', array(':content_model_id' => $_k));
if ($flag) {
//记录操作日志
$message = '{user_name}修改了内容模型({model_name})排序';
$data = array('user_id' => Yii::app()->user->id, 'user_name' => Yii::app()->user->name, 'model_name' => ContentModel::get_model_name_by_id($_k), 'addons_data' => $_POST);
AdminLogs::add(Yii::app()->user->id, 'Content/Model', $_k, 'Modify', 'success', $message, $data);
}
}
ContentModel::update_cache();
//$this->refresh();
$this->redirect[] = array('text' => '', 'href' => '/content/model/index');
$this->message('修改内容模型完成', self::MSG_SUCCESS, true);
}
$this->getView()->assign(array('models' => ContentModelModel::inst()->getModelsByCache()));
}
示例2: actionIndex
/**
*
* @param unknown_type $content_model_id
*/
public function actionIndex($content_model_id)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//保存修改
if (!is_array($_POST['Field']['content_model_field_rank'])) {
$_POST['Field']['content_model_field_rank'] = array();
}
foreach ($_POST['Field']['content_model_field_rank'] as $_k => $_v) {
$flag = Yii::app()->db->createCommand()->update('{{content_model_fields}}', array('content_model_field_rank' => $_POST['Field']['content_model_field_rank'][$_k] ? intval($_POST['Field']['content_model_field_rank'][$_k]) : 255), 'content_model_field_id=:content_model_field_id', array(':content_model_field_id' => $_k));
if ($flag) {
//记录操作日志
$message = '{user_name}修改了内容模型({model_name})字段({field_name})排序';
$data = array('user_id' => Yii::app()->user->id, 'user_name' => Yii::app()->user->name, 'model_name' => ContentModel::get_model_name_by_id($content_model_id), 'field_name' => ContentModelField::get_field_name_by_id($_v), 'addons_data' => $_POST);
AdminLogs::add(Yii::app()->user->id, 'Content/Model/Field', $_k, 'Modify', 'success', $message, $data);
}
}
ContentModelField::update_cache();
//$this->refresh();
$this->redirect[] = array('text' => '', 'href' => url($this->module->id . "/Content/Model/{$content_model_id}/Field/Index"));
$this->message('修改字段排序完成', self::MSG_SUCCESS, true);
}
$fields = ContentModelField::get_fields_by_cache($content_model_id);
$this->render('index', array('fields' => $fields, "content_model_id" => $content_model_id));
}