本文整理汇总了PHP中cmsForm::getForm方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsForm::getForm方法的具体用法?PHP cmsForm::getForm怎么用?PHP cmsForm::getForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsForm
的用法示例。
在下文中一共展示了cmsForm::getForm方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
}
示例2: 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';
}
示例3: getForm
/**
* Загружает и возвращает описание структуры формы
* @param type $form_name
* @param type $params
* @return cmsForm
*/
public function getForm($form_name, $params = false, $path_prefix = '')
{
$form_file = $this->root_path . $path_prefix . 'forms/form_' . $form_name . '.php';
$form_name = $this->name . $form_name;
return cmsForm::getForm($form_file, $form_name, $params);
}
示例4: install_package
//.........这里部分代码省略.........
$core->db->dropIndex($table, $index_name);
}
}
// добавляем нужные
foreach ($add_table_indexes as $table => $indexes) {
foreach ($indexes as $index_name => $fields) {
$core->db->addIndex($table, $fields, $index_name);
}
}
//************************************************************************//
// типы контента
$ctypes = $content_model->getContentTypes();
$varchar_fields = array('seo_keys', 'seo_desc', 'seo_title');
$remove_ctype_indexes = array('_cats' => array('ns_left', 'ns_right', 'ns_differ', 'ns_ignore', 'parent_id'), '_props_bind' => array('cat_id', 'ordering'), '' => array('date_pub', 'user_id', 'parent_id', 'parent_type', 'is_comments_on', 'is_approved', 'date_approved', 'comments', 'rating', 'is_private', 'is_parent_hidden', 'photos_count', 'date_pub_end', 'date_last_modified', 'title'));
$add_ctype_indexes = array('_cats' => array('ns_left' => array('ns_level', 'ns_right', 'ns_left'), 'parent_id' => array('parent_id', 'ns_left')), '_props_bind' => array('ordering' => array('cat_id', 'ordering')), '' => array('date_pub' => array('is_pub', 'is_parent_hidden', 'is_approved', 'date_pub'), 'parent_id' => array('parent_id', 'parent_type', 'date_pub'), 'user_id' => array('user_id', 'date_pub'), 'date_pub_end' => array('date_pub_end')));
$add_ctype_fulltext_indexes = array('' => array('title' => array('title')));
foreach ($ctypes as $ctype) {
// меняем типы сео полям
foreach ($varchar_fields as $varchar_field) {
$core->db->query("ALTER TABLE `{#}{$content_model->table_prefix}{$ctype['name']}` CHANGE `{$varchar_field}` `{$varchar_field}` VARCHAR( 256 ) NULL DEFAULT NULL;");
$core->db->query("ALTER TABLE `{#}{$content_model->table_prefix}{$ctype['name']}_cats` CHANGE `{$varchar_field}` `{$varchar_field}` VARCHAR( 256 ) NULL DEFAULT NULL;");
}
// комментарии по умолчанию включены
$core->db->query("ALTER TABLE `{#}{$content_model->table_prefix}{$ctype['name']}` CHANGE `is_comments_on` `is_comments_on` TINYINT( 1 ) UNSIGNED NULL DEFAULT '1'");
// для текущих записей включаем их
$core->db->query("UPDATE `{#}{$content_model->table_prefix}{$ctype['name']}` SET `is_comments_on` = '1'");
// удаляем ненужные индексы
foreach ($remove_ctype_indexes as $table_postfix => $rcci) {
foreach ($rcci as $index_name) {
$core->db->dropIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $index_name);
}
}
// добавляем нужные обычные индексы
foreach ($add_ctype_indexes as $table_postfix => $indexes) {
foreach ($indexes as $index_name => $fields) {
$core->db->addIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $fields, $index_name);
}
}
// добавляем FULLTEXT индексы только для поля title. остальные поля включаются в индекс в настройках
foreach ($add_ctype_fulltext_indexes as $table_postfix => $fulltext_indexes) {
foreach ($fulltext_indexes as $index_name => $fields) {
$core->db->addIndex($content_model->table_prefix . $ctype['name'] . $table_postfix, $fields, $index_name, 'FULLTEXT');
}
}
}
if (!$core->db->isFieldExists('content_datasets', 'index')) {
$core->db->query("ALTER TABLE `{#}content_datasets` ADD `index` VARCHAR(40) NULL DEFAULT NULL COMMENT 'Название используемого индекса' AFTER `sorting`, ADD INDEX (`index`);");
}
if (!$core->db->isFieldExists('controllers', 'is_external')) {
$core->db->query("ALTER TABLE `{#}controllers` ADD `is_external` TINYINT(1) UNSIGNED NULL DEFAULT NULL COMMENT 'Сторонний компонент' AFTER `is_backend`");
}
if (!$core->db->isFieldExists('rss_feeds', 'template')) {
$core->db->query("ALTER TABLE `{#}rss_feeds` ADD `template` VARCHAR(30) NOT NULL DEFAULT 'feed' COMMENT 'Шаблон ленты';");
}
if (!$core->db->isFieldExists('images_presets', 'quality')) {
$core->db->query("ALTER TABLE `{#}images_presets` ADD `quality` TINYINT(1) NOT NULL DEFAULT '90';");
}
if (!$core->db->getRowsCount('perms_rules', "controller = 'content' AND name = 'disable_comments'", 1)) {
$core->db->query("INSERT INTO `{#}perms_rules` (`controller`,`name`,`type`,`options`) VALUES ('content','disable_comments','flag', NULL)");
}
$core->db->query("UPDATE `{#}perms_rules` SET `options` = 'own,all,full_delete' WHERE controller = 'comments' AND name = 'delete'");
// для всех датасетов создаем индексы, если нужно
$datasets = $content_model->select('ct.name', 'ctype_name')->joinInner('content_types', 'ct', 'ct.id = i.ctype_id')->get('content_datasets', function ($item, $model) {
$item['filters'] = cmsModel::yamlToArray($item['filters']);
$item['sorting'] = cmsModel::yamlToArray($item['sorting']);
return $item;
});
if ($datasets) {
foreach ($datasets as $dataset) {
$index = $content_model->addContentDatasetIndex($dataset, $dataset['ctype_name']);
$content_model->update('content_datasets', $dataset['id'], array('index' => $index), true);
}
}
$config = cmsConfig::getInstance();
$values = $config->getAll();
$values['db_engine'] = 'InnoDB';
if (!$config->save($values)) {
cmsUser::addSessionMessage('Не могу записать файл конфигурации сайта. Добавьте в него строку <b>"db_engine" => "InnoDB",</b>', 'info');
}
// если вдруг для каких то компонентов нет конфига в таблице cms_controllers
// пропускаем компонент карты сайта, т.к. там конфиг динамический
// будем надеяться, что опции в нем хоть раз сохранялись =)
$controllers = $content_model->filterNotEqual('name', 'sitemap')->get('controllers', function ($item, $model) {
$item['options'] = cmsModel::yamlToArray($item['options']);
return $item;
}, 'name');
foreach ($controllers as $controller) {
$controller_root_path = cmsConfig::get('root_path') . 'system/controllers/' . $controller['name'] . '/';
$form_file = $controller_root_path . 'backend/forms/form_options.php';
$form_name = $controller['name'] . 'options';
cmsCore::loadControllerLanguage($controller['name']);
$form = cmsForm::getForm($form_file, $form_name, false);
if ($form) {
$options = $form->parse(new cmsRequest(cmsController::loadOptions($controller['name'])));
} else {
$options = null;
}
$content_model->filterEqual('name', $controller['name'])->updateFiltered('controllers', array('options' => $options));
}
}
示例5: getForm
/**
* Загружает и возвращает описание структуры формы
* @param type $form_name
* @param type $params
* @return cmsForm
*/
public function getForm($form_name, $params = false, $path_prefix = '')
{
$form_file = $this->root_path . $path_prefix . 'forms/form_' . $form_name . '.php';
$_form_name = $this->name . $form_name;
$form = cmsForm::getForm($form_file, $_form_name, $params);
list($form, $params) = cmsEventsManager::hook('form_' . $this->name . '_' . $form_name, array($form, $params));
return $form;
}
示例6: getWidgetOptionsForm
public static function getWidgetOptionsForm($widget_name, $controller_name = false, $options = false)
{
$widget_path = self::getWidgetPath($widget_name, $controller_name);
$path = cmsConfig::get('system_path') . $widget_path;
$form_file = $path . '/options.form.php';
$form_name = 'widget' . ($controller_name ? "_{$controller_name}_" : '_') . "{$widget_name}_options";
$form = cmsForm::getForm($form_file, $form_name, array($options));
if (!$form) {
$form = new cmsForm();
}
$form->is_tabbed = true;
//
// Опции внешнего вида
//
$design_fieldset_id = $form->addFieldset(LANG_DESIGN);
$form->addField($design_fieldset_id, new fieldString('class_wrap', array('title' => LANG_CSS_CLASS_WRAP)));
$form->addField($design_fieldset_id, new fieldString('class_title', array('title' => LANG_CSS_CLASS_TITLE)));
$form->addField($design_fieldset_id, new fieldString('class', array('title' => LANG_CSS_CLASS_BODY)));
$form->addField($design_fieldset_id, new fieldString('tpl_wrap', array('title' => LANG_WIDGET_WRAPPER_TPL, 'hint' => LANG_WIDGET_WRAPPER_TPL_HINT)));
$form->addField($design_fieldset_id, new fieldString('tpl_body', array('title' => LANG_WIDGET_BODY_TPL, 'hint' => sprintf(LANG_WIDGET_BODY_TPL_HINT, $widget_path))));
//
// Опции доступа
//
$access_fieldset_id = $form->addFieldset(LANG_PERMISSIONS);
// Показывать группам
$form->addField($access_fieldset_id, new fieldListGroups('groups_view', array('title' => LANG_SHOW_TO_GROUPS, 'show_all' => true, 'show_guests' => true)));
// Не показывать группам
$form->addField($access_fieldset_id, new fieldListGroups('groups_hide', array('title' => LANG_HIDE_FOR_GROUPS, 'show_all' => false, 'show_guests' => true)));
//
// Опции заголовка
//
$title_fieldset_id = $form->addFieldsetToBeginning(LANG_BASIC_OPTIONS);
// ID виджета
$form->addField($title_fieldset_id, new fieldNumber('id', array('is_hidden' => true)));
// Заголовок виджета
$form->addField($title_fieldset_id, new fieldString('title', array('title' => LANG_TITLE, 'rules' => array(array('required'), array('min_length', 3), array('max_length', 128)))));
// Флаг показа заголовка
$form->addField($title_fieldset_id, new fieldCheckbox('is_title', array('title' => LANG_SHOW_TITLE, 'default' => true)));
// Флаг объединения с предыдущим виджетом
$form->addField($title_fieldset_id, new fieldCheckbox('is_tab_prev', array('title' => LANG_WIDGET_TAB_PREV)));
// Ссылки в заголовке
$form->addField($title_fieldset_id, new fieldText('links', array('title' => LANG_WIDGET_TITLE_LINKS, 'hint' => LANG_WIDGET_TITLE_LINKS_HINT)));
return $form;
}
示例7: getProfileOptionsForm
public function getProfileOptionsForm()
{
if (!$this->hasProfileThemesOptions()) {
return false;
}
$form_file = $this->path . '/profiles/options.form.php';
$form_name = 'template_profile_options';
$form = cmsForm::getForm($form_file, $form_name);
if (!$form) {
$form = new cmsForm();
}
return $form;
}