当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsForm类代码示例

本文整理汇总了PHP中cmsForm的典型用法代码示例。如果您正苦于以下问题:PHP cmsForm类的具体用法?PHP cmsForm怎么用?PHP cmsForm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了cmsForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $template = cmsTemplate::getInstance();
     $config = cmsConfig::getInstance();
     $user = cmsUser::getInstance();
     $contact_id = $this->request->get('contact_id') or cmsCore::error404();
     $content = $this->request->get('content') or cmsCore::error404();
     $csrf_token = $this->request->get('csrf_token');
     // Проверяем валидность
     $is_valid = is_numeric($contact_id) && cmsForm::validateCSRFToken($csrf_token, false);
     if (!$is_valid) {
         $result = array('error' => true, 'message' => '');
         $template->renderJSON($result);
     }
     $contact = $this->model->getContact($user->id, $contact_id);
     // Контакт существует?
     if (!$contact) {
         $result = array('error' => true, 'message' => '');
         $template->renderJSON($result);
     }
     // Контакт не в игноре у отправителя?
     if ($contact['is_ignored']) {
         $result = array('error' => true, 'message' => LANG_PM_CONTACT_IS_IGNORED);
         $template->renderJSON($result);
     }
     // Отправитель не в игноре у контакта?
     if ($this->model->isContactIgnored($contact_id, $user->id)) {
         $result = array('error' => true, 'message' => LANG_PM_YOU_ARE_IGNORED);
         $template->renderJSON($result);
     }
     // Контакт принимает сообщения от этого пользователя?
     if (!$user->isPrivacyAllowed($contact, 'messages_pm')) {
         $result = array('error' => true, 'message' => LANG_PM_CONTACT_IS_PRIVATE);
         $template->renderJSON($result);
     }
     //
     // Отправляем сообщение
     //
     $content_html = cmsEventsManager::hook('html_filter', $content);
     if (!$content_html) {
         $template->renderJSON(array('error' => false, 'date' => false, 'message' => false));
     }
     $this->setSender($user->id);
     $this->addRecipient($contact_id);
     $message_id = $this->sendMessage($content_html);
     //
     // Отправляем уведомление на почту
     //
     $user_to = cmsCore::getModel('users')->getUser($contact_id);
     if (!$user_to['is_online']) {
         $this->sendNoticeEmail('messages_new');
     }
     //
     // Получаем и рендерим добавленное сообщение
     //
     $message = $this->model->getMessage($message_id);
     $message_html = $template->render('message', array('messages' => array($message), 'user' => $user), new cmsRequest(array(), cmsRequest::CTX_INTERNAL));
     // Результат
     $template->renderJSON(array('error' => false, 'date' => date($config->date_format, time()), 'message' => $message_html));
 }
开发者ID:asphix,项目名称:icms2,代码行数:60,代码来源:send.php

示例2: run

 public function run($group)
 {
     if (!cmsUser::isAllowed('groups', 'delete')) {
         cmsCore::error404();
     }
     if (!cmsUser::isAllowed('groups', 'delete', 'all') && $group['owner_id'] != $this->cms_user->id) {
         cmsCore::error404();
     }
     if ($this->request->has('submit')) {
         // подтвержение получено
         $csrf_token = $this->request->get('csrf_token', '');
         $is_delete_content = $this->request->get('is_delete_content', 0);
         if (!cmsForm::validateCSRFToken($csrf_token)) {
             cmsCore::error404();
         }
         list($group, $is_delete_content) = cmsEventsManager::hook('group_before_delete', array($group, $is_delete_content));
         $this->model->removeContentFromGroup($group['id'], $is_delete_content);
         $this->model->deleteGroup($group);
         cmsUser::addSessionMessage(sprintf(LANG_GROUPS_DELETED, $group['title']));
         $this->redirectToAction('');
     } else {
         // спрашиваем подтверждение
         return $this->cms_template->render('group_delete', array('user' => $this->cms_user, 'group' => $group));
     }
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:25,代码来源:group_delete.php

示例3: insertForm

function insertForm($form_title){

    cmsCore::loadClass('form');

    return cmsForm::displayForm(trim($form_title), array(), false);

}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:7,代码来源:filter.php

示例4: run

 public function run($profile)
 {
     $user = cmsUser::getInstance();
     $template = cmsTemplate::getInstance();
     // проверяем наличие доступа
     if ($profile['id'] != $user->id && !$user->is_admin) {
         cmsCore::error404();
     }
     $pricacy_types = cmsEventsManager::hookAll('user_privacy_types');
     $form = new cmsForm();
     $fieldset_id = $form->addFieldset();
     $default_options = array('', 'anyone', 'friends');
     foreach ($pricacy_types as $list) {
         foreach ($list as $name => $type) {
             $options = array();
             if (!isset($type['options'])) {
                 $type['options'] = $default_options;
             }
             foreach ($type['options'] as $option) {
                 if (!$option) {
                     $options[''] = LANG_USERS_PRIVACY_FOR_NOBODY;
                 } else {
                     $options[$option] = constant('LANG_USERS_PRIVACY_FOR_' . mb_strtoupper($option));
                 }
             }
             $form->addField($fieldset_id, new fieldList($name, array('title' => $type['title'], 'default' => 'anyone', 'items' => $options)));
         }
     }
     // Форма отправлена?
     $is_submitted = $this->request->has('submit');
     $options = $this->model->getUserPrivacyOptions($profile['id']);
     if ($is_submitted) {
         // Парсим форму и получаем поля записи
         $options = array_merge($options, $form->parse($this->request, $is_submitted, $options));
         // Проверям правильность заполнения
         $errors = $form->validate($this, $options);
         if (!$errors) {
             // Обновляем профиль и редиректим на его просмотр
             $this->model->updateUserPrivacyOptions($profile['id'], $options);
             $this->redirectTo('users', $profile['id']);
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $template->render('profile_edit_privacy', array('id' => $profile['id'], 'profile' => $profile, 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:47,代码来源:profile_edit_privacy.php

示例5: run

 public function run($friend_id)
 {
     if (!cmsUser::isLogged()) {
         cmsCore::error404();
     }
     $user = cmsUser::getInstance();
     if (!$friend_id) {
         cmsCore::error404();
     }
     if ($user->isFriend($friend_id)) {
         return false;
     }
     $friend = $this->model->getUser($friend_id);
     if (!$friend) {
         cmsCore::error404();
     }
     //
     // Запрос по ссылке из профиля
     //
     if ($this->request->isStandard()) {
         //
         // Если запрос от друга уже существует
         //
         if ($this->model->isFriendshipRequested($friend_id, $user->id)) {
             $this->model->addFriendship($user->id, $friend_id);
             cmsUser::addSessionMessage(sprintf(LANG_USERS_FRIENDS_DONE, $friend['nickname']), 'success');
             $this->sendNoticeAccepted($friend);
             $this->redirectToAction($friend_id);
         }
         //
         // Если запроса от друга не было
         //
         if ($this->request->has('submit')) {
             // подтвержение получено
             $csrf_token = $this->request->get('csrf_token');
             if (!cmsForm::validateCSRFToken($csrf_token)) {
                 cmsCore::error404();
             }
             $this->model->addFriendship($user->id, $friend_id);
             cmsUser::addSessionMessage(LANG_USERS_FRIENDS_SENT);
             $this->sendNoticeRequest($friend);
             $this->redirectToAction($friend_id);
         } else {
             // спрашиваем подтверждение
             return cmsTemplate::getInstance()->render('friend_add', array('user' => $user, 'friend' => $friend));
         }
     }
     //
     // Запрос из уведомления (внутренний)
     //
     if ($this->request->isInternal()) {
         $this->model->addFriendship($user->id, $friend_id);
         $this->sendNoticeAccepted($friend);
         return true;
     }
 }
开发者ID:asphix,项目名称:icms2,代码行数:56,代码来源:friend_add.php

示例6: uploadImage

 public function uploadImage()
 {
     $csrf_token = $this->request->get('csrf_token', '');
     if (!cmsForm::validateCSRFToken($csrf_token)) {
         return $this->cms_template->renderPlain('upload', array('allowed_extensions' => $this->allowed_extensions, 'error' => LANG_FORM_ERRORS));
     }
     $result = $this->images_controller->uploadWithPreset('image', 'wysiwyg_live');
     if (!$result['success']) {
         return $this->cms_template->renderPlain('upload', array('allowed_extensions' => $this->images_controller->getAllowedExtensions(), 'error' => $result['error']));
     }
     return $this->cms_template->renderPlain('image', array('url' => $result['image']['url']));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:12,代码来源:frontend.php

示例7: run

 public function run($profile)
 {
     // проверяем наличие доступа
     if ($profile['id'] != $this->cms_user->id) {
         cmsCore::error404();
     }
     // Форма отправлена?
     $is_submitted = $this->request->has('submit');
     if (!$is_submitted && !$profile['invites_count']) {
         cmsCore::error404();
     }
     $form = new cmsForm();
     $fieldset_id = $form->addFieldset();
     if ($profile['invites_count'] > 1) {
         $form->addField($fieldset_id, new fieldText('emails', array('title' => LANG_USERS_INVITES_EMAILS, 'hint' => LANG_USERS_INVITES_EMAILS_HINT, 'rules' => array(array('required')))));
     }
     if ($profile['invites_count'] == 1) {
         $form->addField($fieldset_id, new fieldString('emails', array('title' => LANG_USERS_INVITES_EMAIL, 'rules' => array(array('required'), array('email')))));
     }
     $input = array();
     if ($is_submitted) {
         // Парсим форму и получаем поля записи
         $input = $form->parse($this->request, $is_submitted);
         // Проверям правильность заполнения
         $errors = $form->validate($this, $input);
         if (!$errors) {
             $results = $this->sendInvites($profile, $input['emails']);
             return $this->cms_template->render('profile_invites_results', array('id' => $profile['id'], 'profile' => $profile, 'results' => $results));
         }
         if ($errors) {
             cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
         }
     }
     return $this->cms_template->render('profile_invites', array('id' => $profile['id'], 'profile' => $profile, 'form' => $form, 'input' => $input, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:35,代码来源:profile_invites.php

示例8: run

 public function run($ctype_id, $parent_id)
 {
     $items = $this->request->get('selected');
     $is_submitted = $this->request->has('items');
     $template = cmsTemplate::getInstance();
     $content_model = cmsCore::getModel('content');
     $ctype = $content_model->getContentType($ctype_id);
     $fields = $content_model->getContentFields($ctype['name']);
     $form = new cmsForm();
     $fieldset_id = $form->addFieldset(LANG_MOVE_TO_CATEGORY);
     $form->addField($fieldset_id, new fieldList('category_id', array('default' => $parent_id, 'generator' => function ($data) {
         $content_model = cmsCore::getModel('content');
         $tree = $content_model->getCategoriesTree($data['ctype_name']);
         foreach ($tree as $c) {
             $items[$c['id']] = str_repeat('- ', $c['ns_level']) . ' ' . $c['title'];
         }
         return $items;
     })));
     $form->addField($fieldset_id, new fieldHidden('items'));
     $data = $form->parse($this->request, $is_submitted);
     if ($is_submitted) {
         // Проверяем правильность заполнения
         $errors = $form->validate($this, $data);
         if (!$errors) {
             $data['items'] = explode(',', $data['items']);
             $content_model->moveContentItemsToCategory($ctype, $data['category_id'], $data['items'], $fields);
             $template->renderJSON(array('errors' => false, 'callback' => 'contentItemsMoved'));
         }
         if ($errors) {
             $template->renderJSON(array('errors' => true));
         }
         $this->halt();
     }
     return $template->render('content_item_move', array('ctype' => $ctype, 'parent_id' => $parent_id, 'items' => $items, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
 }
开发者ID:rookees,项目名称:icms2,代码行数:35,代码来源:content_item_move.php

示例9: save_controller_options

function save_controller_options($controllers)
{
    foreach ($controllers as $controller) {
        $controller_root_path = cmsConfig::get('root_path') . 'system/controllers/' . $controller . '/';
        $form_file = $controller_root_path . 'backend/forms/form_options.php';
        $form_name = $controller . 'options';
        cmsCore::loadControllerLanguage($controller);
        $form = cmsForm::getForm($form_file, $form_name, false);
        if ($form) {
            $options = $form->parse(new cmsRequest(cmsController::loadOptions($controller)));
            cmsCore::getModel('content')->filterEqual('name', $controller)->updateFiltered('controllers', array('options' => $options));
        }
    }
}
开发者ID:Val-Git,项目名称:icms2,代码行数:14,代码来源:install.php

示例10: componentUpdate

 private function componentUpdate($manifest)
 {
     $model = new cmsModel();
     $controller_root_path = $this->cms_config->root_path . 'system/controllers/' . $manifest['package']['name'] . '/';
     $form_file = $controller_root_path . 'backend/forms/form_options.php';
     $form_name = $manifest['package']['name'] . 'options';
     cmsCore::loadControllerLanguage($manifest['package']['name']);
     $form = cmsForm::getForm($form_file, $form_name, false);
     if ($form) {
         $options = $form->parse(new cmsRequest(cmsController::loadOptions($manifest['package']['name'])));
     } else {
         $options = null;
     }
     $model->filterEqual('name', $manifest['package']['name'])->updateFiltered('controllers', array('title' => $manifest['info']['title'], 'options' => $options, 'author' => isset($manifest['author']['name']) ? $manifest['author']['name'] : LANG_CP_PACKAGE_NONAME, 'url' => isset($manifest['author']['url']) ? $manifest['author']['url'] : null, 'version' => $manifest['version']['major'] . '.' . $manifest['version']['minor'] . '.' . $manifest['version']['build'], 'is_backend' => file_exists($controller_root_path . 'backend.php')));
     return 'controllers';
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:16,代码来源:install_finish.php

示例11: init

 public function init($do)
 {
     return array('basic' => array('type' => 'fieldset', 'childs' => array(new fieldString('name', array('title' => LANG_SYSTEM_NAME, 'rules' => array(array('required'), array('sysname'), array('max_length', 20), $do == 'add' ? array('unique_field') : false))), new fieldString('title', array('title' => LANG_CP_FIELD_TITLE, 'rules' => array(array('required'), array('max_length', 100)))), new fieldString('hint', array('title' => LANG_CP_FIELD_HINT, 'rules' => array(array('max_length', 255)))))), 'type' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_TYPE, 'childs' => array(new fieldList('type', array('default' => 'string', 'generator' => function () {
         $field_types = array();
         $field_types = cmsForm::getAvailableFormFields();
         return $field_types;
     })))), 'group' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_FIELDSET, 'childs' => array(new fieldList('fieldset', array('title' => LANG_CP_FIELD_FIELDSET_SELECT, 'generator' => function ($field) {
         $model = cmsCore::getModel('content');
         $model->setTablePrefix('');
         $fieldsets = $model->getContentFieldsets('users');
         $items = array('');
         foreach ($fieldsets as $fieldset) {
             $items[$fieldset] = $fieldset;
         }
         return $items;
     })), new fieldString('new_fieldset', array('title' => LANG_CP_FIELD_FIELDSET_ADD, 'rules' => array(array('max_length', 100)))))), 'visibility' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_VISIBILITY, 'childs' => array(new fieldCheckbox('is_in_filter', array('title' => LANG_CP_FIELD_IN_FILTER)))), 'labels' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_LABELS, 'childs' => array(new fieldList('options:label_in_item', array('title' => LANG_CP_FIELD_LABELS_IN_ITEM, 'default' => 'left', 'items' => array('left' => LANG_CP_FIELD_LABEL_LEFT, 'top' => LANG_CP_FIELD_LABEL_TOP, 'none' => LANG_CP_FIELD_LABEL_NONE))))), 'format' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_FORMAT, 'childs' => array(new fieldCheckbox('options:is_required', array('title' => LANG_VALIDATE_REQUIRED)), new fieldCheckbox('options:is_digits', array('title' => LANG_VALIDATE_DIGITS)), new fieldCheckbox('options:is_alphanumeric', array('title' => LANG_VALIDATE_ALPHANUMERIC)), new fieldCheckbox('options:is_email', array('title' => LANG_VALIDATE_EMAIL)))), 'values' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_VALUES, 'childs' => array(new fieldText('values', array('size' => 8)))), 'read_access' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_GROUPS_READ, 'childs' => array(new fieldListGroups('groups_read', array('show_all' => true)))), 'edit_access' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_GROUPS_EDIT, 'childs' => array(new fieldListGroups('groups_edit', array('show_all' => true)))));
 }
开发者ID:asphix,项目名称:icms2,代码行数:17,代码来源:form_field.php

示例12: run

 public function run($friend_id)
 {
     if (!cmsUser::isLogged()) {
         cmsCore::error404();
     }
     $user = cmsUser::getInstance();
     if (!$friend_id) {
         cmsCore::error404();
     }
     if (!$this->model->isFriendshipExists($user->id, $friend_id)) {
         return false;
     }
     $friend = $this->model->getUser($friend_id);
     if (!$friend) {
         cmsCore::error404();
     }
     //
     // Запрос по ссылке из профиля
     //
     if ($this->request->isStandard()) {
         if ($this->request->has('submit')) {
             // подтвержение получено
             $csrf_token = $this->request->get('csrf_token');
             if (!cmsForm::validateCSRFToken($csrf_token)) {
                 cmsCore::error404();
             }
             $this->model->deleteFriendship($user->id, $friend_id);
             cmsUser::addSessionMessage(sprintf(LANG_USERS_FRIENDS_DELETED, $friend['nickname']));
             $this->sendNoticeDeleted($friend);
             $this->redirectToAction($friend_id);
         } else {
             // спрашиваем подтверждение
             return cmsTemplate::getInstance()->render('friend_delete', array('user' => $user, 'friend' => $friend));
         }
     }
     //
     // Запрос из уведомления (внутренний)
     //
     if ($this->request->isInternal()) {
         $this->model->deleteFriendship($user->id, $friend_id);
         $this->sendNoticeDeleted($friend, true);
         return true;
     }
 }
开发者ID:asphix,项目名称:icms2,代码行数:44,代码来源:friend_delete.php

示例13: uploadImage

 public function uploadImage()
 {
     $template = cmsTemplate::getInstance();
     $csrf_token = $this->request->get('csrf_token');
     if (!cmsForm::validateCSRFToken($csrf_token)) {
         $html = $template->render('upload', array('allowed_extensions' => $this->allowed_extensions, 'error' => LANG_FORM_ERRORS));
         echo $html;
         $this->halt();
     }
     $images_controller = cmsCore::getController('images');
     $result = $images_controller->uploadWithPreset('image', 'wysiwyg_live');
     if (!$result['success']) {
         $html = $template->render('upload', array('allowed_extensions' => $images_controller->getAllowedExtensions(), 'error' => $result['error']));
         echo $html;
         $this->halt();
     }
     $html = $template->render('image', array('url' => $result['image']['url']));
     echo $html;
     $this->halt();
 }
开发者ID:asphix,项目名称:icms2,代码行数:20,代码来源:frontend.php

示例14: init

 public function init($do, $ctype_name)
 {
     $model = cmsCore::getModel('content');
     return array('basic' => array('type' => 'fieldset', 'childs' => array(new fieldString('name', array('title' => LANG_SYSTEM_NAME, 'hint' => $do == 'edit' ? LANG_SYSTEM_EDIT_NOTICE : false, 'rules' => array(array('required'), array('sysname'), array('max_length', 20), $do == 'add' ? array('unique_ctype_field', $ctype_name) : false))), new fieldString('title', array('title' => LANG_CP_FIELD_TITLE, 'rules' => array(array('required'), array('max_length', 100)))), new fieldString('hint', array('title' => LANG_CP_FIELD_HINT, 'rules' => array(array('max_length', 255)))))), 'type' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_TYPE, 'childs' => array(new fieldList('type', array('default' => 'string', 'generator' => function () {
         $field_types = array();
         $field_types = cmsForm::getAvailableFormFields();
         asort($field_types, SORT_STRING);
         return $field_types;
     })))), 'group' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_FIELDSET, 'childs' => array(new fieldList('fieldset', array('title' => LANG_CP_FIELD_FIELDSET_SELECT, 'generator' => function ($field) use($model) {
         $fieldsets = $model->getContentFieldsets($field['ctype_id']);
         $items = array('');
         foreach ($fieldsets as $fieldset) {
             $items[$fieldset] = $fieldset;
         }
         return $items;
     })), new fieldString('new_fieldset', array('title' => LANG_CP_FIELD_FIELDSET_ADD, 'rules' => array(array('max_length', 100)))))), 'visibility' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_VISIBILITY, 'childs' => array(new fieldCheckbox('is_in_item', array('title' => LANG_CP_FIELD_IN_ITEM, 'default' => true)), new fieldCheckbox('is_in_list', array('title' => LANG_CP_FIELD_IN_LIST)), new fieldCheckbox('is_in_filter', array('title' => LANG_CP_FIELD_IN_FILTER)))), 'labels' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_LABELS, 'childs' => array(new fieldList('options:label_in_list', array('title' => LANG_CP_FIELD_LABELS_IN_LIST, 'default' => 'left', 'items' => array('left' => LANG_CP_FIELD_LABEL_LEFT, 'top' => LANG_CP_FIELD_LABEL_TOP, 'none' => LANG_CP_FIELD_LABEL_NONE))), new fieldList('options:label_in_item', array('title' => LANG_CP_FIELD_LABELS_IN_ITEM, 'default' => 'left', 'items' => array('left' => LANG_CP_FIELD_LABEL_LEFT, 'top' => LANG_CP_FIELD_LABEL_TOP, 'none' => LANG_CP_FIELD_LABEL_NONE))))), 'wrap' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_WRAP, 'childs' => array(new fieldList('options:wrap_type', array('title' => LANG_CP_FIELD_WRAP_TYPE, 'default' => 'auto', 'items' => array('left' => LANG_CP_FIELD_WRAP_LTYPE, 'right' => LANG_CP_FIELD_WRAP_RTYPE, 'none' => LANG_CP_FIELD_WRAP_NTYPE, 'auto' => LANG_CP_FIELD_WRAP_ATYPE))), new fieldString('options:wrap_width', array('title' => LANG_CP_FIELD_WRAP_WIDTH, 'hint' => LANG_CP_FIELD_WRAP_WIDTH_HINT, 'default' => '')))), 'format' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_FORMAT, 'childs' => array(new fieldCheckbox('options:is_required', array('title' => LANG_VALIDATE_REQUIRED)), new fieldCheckbox('options:is_digits', array('title' => LANG_VALIDATE_DIGITS)), new fieldCheckbox('options:is_alphanumeric', array('title' => LANG_VALIDATE_ALPHANUMERIC)), new fieldCheckbox('options:is_email', array('title' => LANG_VALIDATE_EMAIL)), new fieldCheckbox('options:is_unique', array('title' => LANG_VALIDATE_UNIQUE)))), 'values' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_VALUES, 'childs' => array(new fieldText('values', array('size' => 8)))), 'profile' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_PROFILE_VALUE, 'childs' => array(new fieldList('options:profile_value', array('hint' => LANG_CP_FIELD_PROFILE_VALUE_HINT, 'generator' => function ($field) use($model) {
         $model->setTablePrefix('');
         // Ниже модель не используется
         $fields = $model->filterIn('type', array('string', 'text', 'html', 'list', 'city'))->getContentFields('{users}');
         $items = array('' => LANG_NO) + array_collection_to_list($fields, 'name', 'title');
         return $items;
     })))), 'read_access' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_GROUPS_READ, 'childs' => array(new fieldListGroups('groups_read', array('show_all' => true)))), 'edit_access' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_GROUPS_EDIT, 'childs' => array(new fieldListGroups('groups_edit', array('show_all' => true)))), 'filter_access' => array('type' => 'fieldset', 'title' => LANG_CP_FIELD_IN_FILTER, 'childs' => array(new fieldListGroups('filter_view', array('show_all' => true)))));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:23,代码来源:form_ctypes_field.php

示例15: run

 public function run($comment_id)
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $is_submit = $this->request->get('save', 0);
     $comment = $this->model->getComment($comment_id);
     if (!$is_submit) {
         return $this->cms_template->render('backend/text_edit', array('comment' => $comment, 'action' => href_to($this->root_url, 'text_edit', array($comment['id']))));
     }
     $csrf_token = $this->request->get('csrf_token', '');
     if (!cmsForm::validateCSRFToken($csrf_token) || !$comment) {
         $this->cms_template->renderJSON(array('errors' => true));
     }
     $content = $this->request->get('content', '');
     // Типографируем текст
     $content_html = cmsEventsManager::hook('html_filter', $content);
     if (!$content_html) {
         $this->cms_template->renderJSON(array('errors' => array('content' => ERR_VALIDATE_REQUIRED)));
     }
     list($comment_id, $content, $content_html) = cmsEventsManager::hook('comment_before_update', array($comment_id, $content, $content_html));
     $this->model->updateCommentContent($comment_id, $content, $content_html);
     return $this->cms_template->renderJSON(array('errors' => false, 'callback' => 'successSaveComment', 'comment_id' => $comment_id, 'text' => string_short($content_html, 350)));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:24,代码来源:text_edit.php


注:本文中的cmsForm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。