/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $urlManager = Mvc::getView()->getUrlManager(); $nowTime = date('Y-m-d H:i:s'); $output = array('advert_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_ID_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_ID_HINT')), 'advert_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_NAME_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_NAME_HINT'), 'required' => true), 'type_name' => array('__tid__' => 'main', 'type' => 'string', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_NAME_LABEL')), 'type_key' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_TYPE_KEY_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_TYPE_KEY_HINT'), 'readonly' => true), 'description' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_ADVERT_ADVERTS_DESCRIPTION_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_DESCRIPTION_HINT')), 'is_published' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_ADVERT_ADVERTS_IS_PUBLISHED_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_IS_PUBLISHED_HINT'), 'options' => DataAdverts::getIsPublishedEnum(), 'value' => DataAdverts::IS_PUBLISHED_Y), 'dt_publish_up' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_ADVERT_ADVERTS_DT_PUBLISH_UP_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_DT_PUBLISH_UP_HINT'), 'value' => $nowTime), 'dt_publish_down' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_ADVERT_ADVERTS_DT_PUBLISH_DOWN_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_DT_PUBLISH_DOWN_HINT')), 'sort' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_SORT_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_SORT_HINT'), 'required' => true, 'value' => 1000), 'show_type' => array('__tid__' => 'advanced', 'type' => 'radio', 'label' => Text::_('MOD_ADVERT_ADVERTS_SHOW_TYPE_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_SHOW_TYPE_HINT'), 'options' => DataAdverts::getShowTypeEnum(), 'value' => DataAdverts::SHOW_TYPE_IMAGE), 'show_code' => array('__tid__' => 'advanced', 'type' => 'textarea', 'label' => Text::_('MOD_ADVERT_ADVERTS_SHOW_CODE_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_SHOW_CODE_HINT'), 'required' => true, 'rows' => 16), 'title' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_TITLE_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_TITLE_HINT'), 'required' => true), 'advert_url' => array('__tid__' => 'advanced', 'type' => 'textarea', 'label' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_URL_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_URL_HINT'), 'required' => true, 'rows' => 3), 'advert_src' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_SRC_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_SRC_HINT'), 'required' => true), 'advert_src_file' => array('__tid__' => 'advanced', 'type' => 'string', 'label' => '', 'hint' => '', 'value' => '<div id="advert_src_file" url="' . $urlManager->getUrl('ajaxupload', '', '') . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'advert_src2' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_SRC2_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ADVERT_SRC2_HINT')), 'advert_src2_file' => array('__tid__' => 'advanced', 'type' => 'string', 'label' => '', 'hint' => '', 'value' => '<div id="advert_src2_file" url="' . $urlManager->getUrl('ajaxupload', '', '') . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'attr_alt' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ATTR_ALT_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ATTR_ALT_HINT'), 'required' => true), 'attr_width' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ATTR_WIDTH_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ATTR_WIDTH_HINT'), 'value' => 0), 'attr_height' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ATTR_HEIGHT_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ATTR_HEIGHT_HINT'), 'value' => 0), 'attr_fontsize' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ATTR_FONTSIZE_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ATTR_FONTSIZE_HINT')), 'attr_target' => array('__tid__' => 'advanced', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_ATTR_TARGET_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_ATTR_TARGET_HINT'), 'value' => '_blank'), 'dt_created' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERTS_DT_CREATED_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERTS_DT_CREATED_HINT'), 'disabled' => true)); return $output; }
/** * (non-PHPdoc) * @see \tfc\mvc\interfaces\Action::run() */ public function run() { $req = Ap::getRequest(); $submitType = $req->getTrim('submit_type'); $id = $req->getInteger('id'); $columnName = $req->getTrim('column_name'); $opType = $req->getTrim('op_type'); $value = $req->getParam('value'); if ($submitType === 'save') { $mod = Model::getInstance('Members'); $ret = $mod->opAccount($columnName, $opType, $id, $value); $url = $this->applyParams($mod->getLLU(), $ret); $this->redirect($url); exit; } $loginName = $req->getTrim('login_name'); $html = Mvc::getView()->getHtml(); $title = Text::_('MOD_MEMBER_MEMBERS_OP_' . $columnName . '_' . $opType) . ': ' . $loginName . ' , ' . $value; $url = Mvc::getView()->getUrlManager()->getUrl('ajaxaccount', Mvc::$controller, Mvc::$module, array('id' => $id, 'column_name' => $columnName, 'op_type' => $opType, 'submit_type' => 'save', 'value' => '')); $body = $html->input('hidden', 'url', $url); $body .= $html->openTag('div', array('class' => 'form-group')); $body .= $html->tag('label', array('class' => 'col-lg-2 control-label'), Text::_('MOD_MEMBER_MEMBERS_OP_' . $opType)); $body .= $html->tag('div', array('class' => 'col-lg-4'), $html->input('text', 'value', '', array('class' => 'form-control input-sm'))); if ($opType === 'reduce' || $opType === 'reduce_freeze' || $opType === 'freeze') { $body .= $html->tag('span', array('class' => 'control-label'), Text::_('MOD_MEMBER_MEMBERS_OP_REDUCE_HINT')); } $body .= $html->closeTag('div'); $this->display(array('title' => $title, 'body' => $body)); }
/** * 获取A标签 * @param array $data * @param array $attributes * @return string */ public static function a(array &$data, array $attributes = array()) { if ($attributes === array()) { $attributes = self::getAttributes($data); } $url = isset($data['menu_url']) ? $data['menu_url'] : '#'; $content = isset($data['menu_name']) ? $data['menu_name'] : ''; return Mvc::getView()->getHtml()->a($content, $url, $attributes); }
/** * (non-PHPdoc) * @see \libapp\Component::getWidgetDirectory() */ public function getWidgetDirectory() { list(, $comName, $className) = explode('\\', strtolower(get_class($this))); if ($this->_widgetDirectory === null) { $viw = Mvc::getView(); $this->_widgetDirectory = $viw->viewDirectory . DS . $viw->skinName . DS . 'components' . DS . $comName . DS . $this->poll_key; } return $this->_widgetDirectory; }
/** * 构造方法,初始化模板解析类、URL管理类、页面辅助类、模型名、控制器名、方法名、缺省的列表页方法名、缺省的详情页方法名、缺省的新增数据方法名、缺省的编辑数据方法名 */ public function __construct() { $this->view = Mvc::getView(); $this->urlManager = $this->view->getUrlManager(); $this->html = $this->view->getHtml(); $this->module = Mvc::$module; $this->controller = Mvc::$controller; $this->action = Mvc::$action; list(, $moduleName, , $className) = explode('\\', get_class($this)); if ($this->_srvName === '') { $this->_srvName = $moduleName; } if ($this->_className === '') { $this->_className = $className; } $this->_init(); }
/** * (non-PHPdoc) * @see \tfc\mvc\interfaces\Action::run() */ public function run() { $req = Ap::getRequest(); $mod = Model::getInstance('Topic', 'topic'); $key = $req->getTrim('key'); if ($key === '') { $this->err404(); } $row = $mod->findByTopicKey($key); if (!$row || !is_array($row) || !isset($row['topic_id']) || !isset($row['topic_name'])) { $this->err404(); } $this->assignSystem(); $this->assignUrl(); $this->assignLanguage(); $this->assign($row); Mvc::getView()->display($this->getDefaultTplName()); }
/** * (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; }
/** * (non-PHPdoc) * @see \tfc\mvc\interfaces\Action::run() */ public function run() { $ret = array(); $this->assignSystem(); $this->assignUrl(); $this->assignLanguage(); $req = Ap::getRequest(); $viw = Mvc::getView(); $mod = new Account(); if ($req->isPost()) { $loginName = $req->getTrim('login_name'); $password = $req->getTrim('password'); $rememberMe = (bool) $req->getInteger('remember_me'); $ret = $mod->login($loginName, $password, $rememberMe); } $httpReferer = PageHelper::getHttpReferer(); if ($httpReferer === '') { $httpReferer = 'administrator.php'; } $viw->assign('http_referer', $httpReferer); $viw->assign($ret); $tplName = $this->getDefaultTplName(); $viw->display($tplName); }
/** * 获取URL管理类 * @return \tfc\mvc\UrlManager */ public function getUrlManager() { return Mvc::getView()->getUrlManager(); }
/** * 获取Glyphicons图标按钮和工具提示 * @param array $params * @return string */ public static function getGlyphicon(array $params = array()) { $type = isset($params['type']) ? $params['type'] : ''; $url = isset($params['url']) ? $params['url'] : ''; $jsfunc = isset($params['jsfunc']) ? $params['jsfunc'] : ''; $title = isset($params['title']) ? $params['title'] : ''; $placement = isset($params['placement']) ? $params['placement'] : 'left'; $style = isset($params['style']) ? $params['style'] : ''; $click = $jsfunc . '(\'' . $url . '\')'; $attributes = array('class' => 'glyphicon glyphicon-' . $type, 'data-toggle' => 'tooltip', 'data-placement' => $placement, 'data-original-title' => $title, 'onclick' => 'return ' . $click . ';'); if ($style !== '') { $attributes['style'] = $style; } return Mvc::getView()->getHtml()->tag('span', $attributes, ''); }
/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $urlManager = Mvc::getView()->getUrlManager(); $output = array('member_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MEMBER_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MEMBER_ID_HINT')), 'login_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LOGIN_NAME_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LOGIN_NAME_HINT'), 'required' => true), 'realname' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_REALNAME_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_REALNAME_HINT')), 'sex' => array('__tid__' => 'main', 'type' => 'radio', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SEX_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SEX_HINT'), 'options' => DataSocial::getSexEnum(), 'value' => DataSocial::SEX_MALE), 'birth_ymd' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_YMD_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_YMD_HINT'), 'format' => 'date'), 'is_pub_birth' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_BIRTH_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_BIRTH_HINT'), 'options' => DataSocial::getIsPubBirthEnum(), 'value' => DataSocial::IS_PUB_BIRTH_Y), 'birth_md' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_MD_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BIRTH_MD_HINT')), 'anniversary' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ANNIVERSARY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ANNIVERSARY_HINT')), 'is_pub_anniversary' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_ANNIVERSARY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_ANNIVERSARY_HINT'), 'options' => DataSocial::getIsPubAnniversaryEnum(), 'value' => DataSocial::IS_PUB_ANNIVERSARY_Y), 'head_portrait' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_HINT')), 'head_portrait_file' => array('__tid__' => 'main', 'type' => 'string', 'label' => '', 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_HEAD_PORTRAIT_HINT'), 'value' => '<div id="head_portrait_file" url="' . $urlManager->getUrl('ajaxupload', '', '', array('from' => 'picture')) . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'introduce' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTRODUCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTRODUCE_HINT')), 'interests' => array('__tid__' => 'main', 'type' => 'checkbox', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTERESTS_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_INTERESTS_HINT'), 'options' => DataSocial::getInterestsEnum()), 'is_pub_interests' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_INTERESTS_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_INTERESTS_HINT'), 'options' => DataSocial::getIsPubInterestsEnum(), 'value' => DataSocial::IS_PUB_INTERESTS_Y), 'telephone' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_TELEPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_TELEPHONE_HINT')), 'mobiphone' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MOBIPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MOBIPHONE_HINT')), 'is_pub_mobiphone' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_MOBIPHONE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_MOBIPHONE_HINT'), 'options' => DataSocial::getIsPubMobiphoneEnum(), 'value' => DataSocial::IS_PUB_MOBIPHONE_Y), 'email' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_EMAIL_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_EMAIL_HINT')), 'is_pub_email' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_EMAIL_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_IS_PUB_EMAIL_HINT'), 'options' => DataSocial::getIsPubEmailEnum(), 'value' => DataSocial::IS_PUB_EMAIL_Y), 'live_country_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_ID_HINT')), 'live_province_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_ID_HINT')), 'live_city_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_ID_HINT')), 'live_district_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_ID_HINT')), 'live_country' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_COUNTRY_HINT')), 'live_province' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_PROVINCE_HINT')), 'live_city' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_CITY_HINT')), 'live_district' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_DISTRICT_HINT')), 'live_street' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_STREET_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_STREET_HINT')), 'live_zipcode' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_ZIPCODE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_LIVE_ZIPCODE_HINT')), 'address_country_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_ID_HINT')), 'address_province_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_ID_HINT')), 'address_city_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_ID_HINT')), 'address_district_id' => array('__tid__' => 'main', 'type' => 'select', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_ID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_ID_HINT')), 'address_country' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_COUNTRY_HINT')), 'address_province' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_PROVINCE_HINT')), 'address_city' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_CITY_HINT')), 'address_district' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_DISTRICT_HINT')), 'address_street' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_STREET_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_STREET_HINT')), 'address_zipcode' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_ZIPCODE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_ADDRESS_ZIPCODE_HINT')), 'qq' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_QQ_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_QQ_HINT')), 'msn' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MSN_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_MSN_HINT')), 'skypeid' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SKYPEID_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_SKYPEID_HINT')), 'wangwang' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WANGWANG_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WANGWANG_HINT')), 'weibo' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEIBO_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEIBO_HINT')), 'blog' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BLOG_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_BLOG_HINT')), 'website' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEBSITE_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_WEBSITE_HINT')), 'fax' => array('__tid__' => 'contact', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_FAX_LABEL'), 'hint' => Text::_('MOD_MEMBER_MEMBER_SOCIAL_FAX_HINT')), 'addresses' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_MEMBER_URLS_ADDRESSES_INDEX'), 'hint' => Text::_('MOD_MEMBER_URLS_ADDRESSES_CREATE'))); return $output; }
/** * 在URL后拼接QueryString参数 * @param string $url * @param array $params * @return string */ public static function applyParams($url, array $params = array()) { return Mvc::getView()->getUrlManager()->applyParams($url, $params); }
/** * (non-PHPdoc) * @see \tfc\mvc\interfaces\Action::run() */ public function run() { $beforeContent = Mvc::getView()->widget('components\\adverts\\Adverts', array('type_key' => 'mainslide'), array(), true); $this->assign('beforeLayoutContent', $beforeContent); $this->render(); }
/** * 初始化默认的module、controller和action名 * @return void */ public function _initDefaultRouter() { $router = Mvc::getRouter(); $router->setDefaultModule('system')->setDefaultController('site')->setDefaultAction('index'); }
/** * 设置路由方式 * @param string $routeType * @return \tfc\mvc\UrlManager * @throws InvalidArgumentException 如果参数不是有效的路由方式,抛出异常 */ public function setRouteType($routeType = null) { if ($routeType === null) { $route = Mvc::getRouter()->getCurrRoute(); if ($this->isSupervar($route)) { $routeType = self::ROUTE_SUPERVAR; } elseif ($this->isRewrite($route)) { $routeType = self::ROUTE_REWRITE; } elseif ($this->isSimple($route)) { $routeType = self::ROUTE_SIMPLE; } } $routeType = strtoupper((string) $routeType); if (!defined('static::ROUTE_' . $routeType)) { throw new InvalidArgumentException(sprintf('UrlManager Route Type "%s" invalid.', $routeType)); } $this->_routeType = $routeType; return $this; }
/** * 设置一对或多对模板变量 * @param mixed $key * @param mixed $value * @return \tfc\mvc\interfaces\View */ public function assign($key, $value = null) { return Mvc::getView()->assign($key, $value); }
/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $urlManager = Mvc::getView()->getUrlManager(); $output = array('topic_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_TOPIC_TOPIC_TOPIC_ID_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_TOPIC_ID_HINT')), 'topic_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_TOPIC_NAME_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_TOPIC_NAME_HINT'), 'required' => true), 'topic_key' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_TOPIC_KEY_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_TOPIC_KEY_HINT'), 'required' => true), 'cover' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_COVER_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_COVER_HINT'), 'required' => true), 'cover_file' => array('__tid__' => 'main', 'type' => 'string', 'label' => '', 'hint' => '', 'value' => '<div id="cover_file" url="' . $urlManager->getUrl('ajaxupload', '', '') . '" name="upload">' . Text::_('CFG_SYSTEM_GLOBAL_UPLOAD') . '</div>'), 'meta_title' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_META_TITLE_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_META_TITLE_HINT'), 'required' => true), 'meta_keywords' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_META_KEYWORDS_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_META_KEYWORDS_HINT'), 'required' => true), 'meta_description' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_TOPIC_TOPIC_META_DESCRIPTION_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_META_DESCRIPTION_HINT'), 'required' => true), 'html_style' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_TOPIC_TOPIC_HTML_STYLE_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_HTML_STYLE_HINT')), 'html_script' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_TOPIC_TOPIC_HTML_SCRIPT_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_HTML_SCRIPT_HINT')), 'html_head' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_TOPIC_TOPIC_HTML_HEAD_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_HTML_HEAD_HINT')), 'html_body' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_TOPIC_TOPIC_HTML_BODY_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_HTML_BODY_HINT'), 'required' => true, 'rows' => 20), 'is_published' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_TOPIC_TOPIC_IS_PUBLISHED_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_IS_PUBLISHED_HINT'), 'options' => DataTopic::getIsPublishedEnum(), 'value' => DataTopic::IS_PUBLISHED_Y), 'sort' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_SORT_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_SORT_HINT'), 'required' => true), 'use_header' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_TOPIC_TOPIC_USE_HEADER_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_USE_HEADER_HINT'), 'options' => DataTopic::getUseHeaderEnum(), 'value' => DataTopic::USE_HEADER_Y), 'use_footer' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_TOPIC_TOPIC_USE_FOOTER_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_USE_FOOTER_HINT'), 'options' => DataTopic::getUseFooterEnum(), 'value' => DataTopic::USE_FOOTER_Y), 'dt_created' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_TOPIC_TOPIC_DT_CREATED_LABEL'), 'hint' => Text::_('MOD_TOPIC_TOPIC_DT_CREATED_HINT'), 'disabled' => true)); return $output; }
/** * 获取专题链接 * @param array $data * @return string */ public function getTopicView(array $data) { $topicKey = isset($data['topic_key']) ? trim($data['topic_key']) : ''; if ($topicKey === '') { return ''; } $urlManager = Mvc::getView()->getUrlManager(); return $urlManager->getUrl('view', 'show', 'topic', array('key' => $topicKey)); }
/** * 初始化默认的module、controller和action名 * @return void */ public function _initDefaultRouter() { $router = Mvc::getRouter(); $router->setDefaultModule('posts')->setDefaultController('show')->setDefaultAction('home'); }