Example #1
0
 /**
  * 获取“是否发表”验证规则
  * @param mixed $value
  * @return array
  */
 public function getIsPublishedRule($value)
 {
     $enum = DataComments::getIsPublishedEnum();
     return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_POST_COMMENTS_IS_PUBLISHED_INARRAY'), implode(', ', $enum))));
 }
Example #2
0
 /**
  * (non-PHPdoc)
  * @see \library\BaseModel::getElementsRender()
  */
 public function getElementsRender()
 {
     $output = array('comment_id' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_COMMENT_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_COMMENT_ID_HINT')), 'comment_pid' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_COMMENT_PID_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_COMMENT_PID_HINT'), 'required' => true), 'post_id' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_POST_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_POST_ID_HINT'), 'required' => true), 'post_title' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POSTS_TITLE_LABEL'), 'hint' => ''), 'content' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_CONTENT_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_CONTENT_HINT'), 'required' => true), 'author_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_NAME_HINT'), 'required' => true), 'author_mail' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_MAIL_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_MAIL_HINT'), 'required' => true), 'author_url' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_URL_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_AUTHOR_URL_HINT'), 'required' => true), 'is_published' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_IS_PUBLISHED_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_IS_PUBLISHED_HINT'), 'options' => DataComments::getIsPublishedEnum(), 'value' => DataComments::IS_PUBLISHED_Y), 'good_count' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_GOOD_COUNT_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_GOOD_COUNT_HINT'), 'required' => true), 'bad_count' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_BAD_COUNT_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_BAD_COUNT_HINT'), 'required' => true), 'creator_id' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_CREATOR_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_CREATOR_ID_HINT'), 'required' => true), 'creator_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_CREATOR_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_CREATOR_NAME_HINT'), 'required' => true), 'last_modifier_id' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_LAST_MODIFIER_ID_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_LAST_MODIFIER_ID_HINT'), 'required' => true), 'last_modifier_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_LAST_MODIFIER_NAME_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_LAST_MODIFIER_NAME_HINT'), 'required' => true), 'dt_created' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_DT_CREATED_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_DT_CREATED_HINT'), 'required' => true), 'dt_last_modified' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_DT_LAST_MODIFIED_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_DT_LAST_MODIFIED_HINT'), 'required' => true), 'ip_created' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_IP_CREATED_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_IP_CREATED_HINT'), 'required' => true), 'ip_last_modified' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_IP_LAST_MODIFIED_LABEL'), 'hint' => Text::_('MOD_POSTS_POST_COMMENTS_IP_LAST_MODIFIED_HINT'), 'required' => true), 'dt_created_le' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_DT_CREATED_LE_LABEL')), 'dt_created_ge' => array('type' => 'text', 'label' => Text::_('MOD_POSTS_POST_COMMENTS_DT_CREATED_GE_LABEL')));
     return $output;
 }