コード例 #1
0
ファイル: Posts.php プロジェクト: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \library\BaseModel::getElementsRender()
  */
 public function getElementsRender()
 {
     $urlManager = Mvc::getView()->getUrlManager();
     $nowTime = date('Y-m-d H:i:s');
     $output = array('post_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_POSTS_POSTS_POST_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_POST_ID_HINT')), 'title' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_TITLE_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_TITLE_HINT'), 'required' => true), 'alias' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_ALIAS_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_ALIAS_HINT')), 'picture' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_PICTURE_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_PICTURE_HINT')), 'picture_file' => array('__tid__' => 'main', 'type' => 'string', 'label' => '', 'hint' => Text::_('MOD_POSTS_POSTS_PICTURE_HINT'), 'value' => '<div id="picture_file" url="' . $urlManager->getUrl('ajaxupload', '', '', array('from' => 'picture')) . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'content' => array('__tid__' => 'main', 'type' => 'ckeditor', 'id' => 'content', 'height' => '960px', 'toolbar' => 'post', 'url' => $urlManager->getUrl('ajaxupload', '', '', array('from' => 'ckeditor'))), 'keywords' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_KEYWORDS_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_KEYWORDS_HINT')), 'description' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_POSTS_POSTS_DESCRIPTION_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_DESCRIPTION_HINT')), 'sort' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_SORT_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_SORT_HINT'), 'required' => true, 'value' => 10000), 'category_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_POSTS_POSTS_CATEGORY_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_CATEGORY_ID_HINT')), 'category_name' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_POSTS_POSTS_CATEGORY_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_CATEGORY_NAME_HINT')), 'module_id' => array('__tid__' => 'profile', 'type' => 'select', 'label' => Text::_('MOD_POSTS_POSTS_MODULE_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_MODULE_ID_HINT')), 'password' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_PASSWORD_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_PASSWORD_HINT')), 'is_head' => array('__tid__' => 'advanced', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_IS_HEAD_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IS_HEAD_HINT'), 'options' => DataPosts::getIsHeadEnum(), 'value' => DataPosts::IS_HEAD_N), 'is_recommend' => array('__tid__' => 'advanced', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_IS_RECOMMEND_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IS_RECOMMEND_HINT'), 'options' => DataPosts::getIsRecommendEnum(), 'value' => DataPosts::IS_RECOMMEND_N), 'is_jump' => array('__tid__' => 'advanced', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_IS_JUMP_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IS_JUMP_HINT'), 'options' => DataPosts::getIsJumpEnum(), 'value' => DataPosts::IS_JUMP_N), 'jump_url' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_JUMP_URL_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_JUMP_URL_HINT'), 'required' => true), 'is_published' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_IS_PUBLISHED_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IS_PUBLISHED_HINT'), 'options' => DataPosts::getIsPublishedEnum(), 'value' => DataPosts::IS_PUBLISHED_Y), 'dt_publish_up' => array('__tid__' => 'advanced', 'type' => 'datetimepicker', 'label' => Text::_('MOD_POSTS_POSTS_DT_PUBLISH_UP_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_DT_PUBLISH_UP_HINT'), 'value' => $nowTime), 'dt_publish_down' => array('__tid__' => 'advanced', 'type' => 'datetimepicker', 'label' => Text::_('MOD_POSTS_POSTS_DT_PUBLISH_DOWN_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_DT_PUBLISH_DOWN_HINT')), 'comment_status' => array('__tid__' => 'advanced', 'type' => 'radio', 'label' => Text::_('MOD_POSTS_POSTS_COMMENT_STATUS_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_COMMENT_STATUS_HINT'), 'options' => DataPosts::getCommentStatusEnum(), 'value' => DataPosts::COMMENT_STATUS_PUBLISH), 'allow_other_modify' => array('__tid__' => 'advanced', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_ALLOW_OTHER_MODIFY_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_ALLOW_OTHER_MODIFY_HINT'), 'options' => DataPosts::getAllowOtherModifyEnum(), 'value' => DataPosts::ALLOW_OTHER_MODIFY_Y), 'hits' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_HITS_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_HITS_HINT'), 'value' => 0), 'praise_count' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_PRAISE_COUNT_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_PRAISE_COUNT_HINT'), 'value' => 0), 'comment_count' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_COMMENT_COUNT_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_COMMENT_COUNT_HINT'), 'value' => 0), 'creator_id' => array('__tid__' => 'system', 'type' => 'hidden', 'label' => Text::_('MOD_POSTS_POSTS_CREATOR_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_CREATOR_ID_HINT')), 'creator_name' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_CREATOR_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_CREATOR_NAME_HINT'), 'disabled' => true), 'last_modifier_id' => array('__tid__' => 'system', 'type' => 'hidden', 'label' => Text::_('MOD_POSTS_POSTS_LAST_MODIFIER_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_LAST_MODIFIER_ID_HINT')), 'last_modifier_name' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_LAST_MODIFIER_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_LAST_MODIFIER_NAME_HINT'), 'disabled' => true), 'dt_created' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_CREATED_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_DT_CREATED_HINT'), 'disabled' => true), 'dt_last_modified' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_LAST_MODIFIED_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_DT_LAST_MODIFIED_HINT'), 'disabled' => true), 'ip_created' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_IP_CREATED_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IP_CREATED_HINT'), 'disabled' => true), 'ip_last_modified' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_IP_LAST_MODIFIED_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_IP_LAST_MODIFIED_HINT'), 'disabled' => true), 'trash' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POSTS_TRASH_LABEL'), 'hint' => Text::_('MOD_POSTS_POSTS_TRASH_HINT'), 'options' => DataPosts::getTrashEnum(), 'value' => DataPosts::TRASH_N), 'order' => array('type' => 'select', 'label' => Text::_('CFG_SYSTEM_GLOBAL_ORDER'), 'options' => array('hits DESC' => Text::_('MOD_POSTS_POSTS_HITS_LABEL'), 'praise_count DESC' => Text::_('MOD_POSTS_POSTS_PRAISE_COUNT_LABEL'), 'comment_count DESC' => Text::_('MOD_POSTS_POSTS_COMMENT_COUNT_LABEL'), 'dt_created DESC' => Text::_('MOD_POSTS_POSTS_DT_CREATED_LABEL'), 'sort' => Text::_('MOD_POSTS_POSTS_SORT_LABEL'))), 'dt_created_ge' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_CREATED_GE_LABEL')), 'dt_created_le' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_CREATED_LE_LABEL')), 'dt_last_modified_ge' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_LAST_MODIFIED_GE_LABEL')), 'dt_last_modified_le' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_DT_LAST_MODIFIED_LE_LABEL')));
     if (Mvc::$action === 'modify' || Mvc::$action === 'view') {
         $id = Ap::getRequest()->getInteger('id');
         if ($id > 0) {
             $fields = $this->getModuleFieldsByPostId($id);
             foreach ($fields as $name => $field) {
                 $fields[$name]['__tid__'] = 'profile';
                 $fields[$name]['type'] = 'textarea';
             }
             $output = array_merge($output, $fields);
         }
     }
     return $output;
 }
コード例 #2
0
ファイル: Posts.php プロジェクト: suyuanen/trotri
 /**
  * 获取“评论设置”
  * @param string $commentStatus
  * @return string
  */
 public function getCommentStatusLangByCommentStatus($commentStatus)
 {
     $enum = DataPosts::getCommentStatusEnum();
     return isset($enum[$commentStatus]) ? $enum[$commentStatus] : '';
 }
コード例 #3
0
ファイル: FpPosts.php プロジェクト: suyuanen/trotri
 /**
  * 获取“是否删除”验证规则
  * @param mixed $value
  * @return array
  */
 public function getTrashRule($value)
 {
     $enum = DataPosts::getTrashEnum();
     return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_POSTS_TRASH_INARRAY'), implode(', ', $enum))));
 }