本文整理汇总了PHP中cmsCore::getWidgetOptionsForm方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::getWidgetOptionsForm方法的具体用法?PHP cmsCore::getWidgetOptionsForm怎么用?PHP cmsCore::getWidgetOptionsForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::getWidgetOptionsForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($binded_id = false)
{
if (!$this->request->isAjax()) {
cmsCore::error404();
}
if (!$binded_id) {
cmsCore::error404();
}
$template = cmsTemplate::getInstance();
$widgets_model = cmsCore::getModel('widgets');
$widget = $widgets_model->getWidgetBinding($binded_id);
cmsCore::loadWidgetLanguage($widget['name'], $widget['controller']);
$form = cmsCore::getWidgetOptionsForm($widget['name'], $widget['controller'], $widget['options']);
return $template->render('widgets_settings', array('form' => $form, 'widget' => $widget, 'errors' => false));
}
示例2: __construct
public function __construct($widget)
{
$this->name = $widget['name'];
$this->controller = $widget['controller'];
$form = cmsCore::getWidgetOptionsForm($this->name, $this->controller, $widget['options']);
$data = $form->parse(new cmsRequest($widget), true);
foreach ($data as $field => $value) {
$this->{$field} = $value;
}
$this->css_class = $widget['class'];
$this->css_class_title = empty($widget['class_title']) ? '' : $widget['class_title'];
$this->css_class_wrap = empty($widget['class_wrap']) ? '' : $widget['class_wrap'];
$this->links = $widget['links'];
$this->position = $widget['position'];
$this->template = $this->name;
if (!empty($widget['tpl_wrap'])) {
$this->setWrapper($widget['tpl_wrap']);
}
if (!empty($widget['tpl_body'])) {
$this->setTemplate($widget['tpl_body']);
}
}
示例3: run
public function run()
{
if (!$this->request->isAjax()) {
cmsCore::error404();
}
$widget_id = $this->request->get('widget_id', 0);
$page_id = $this->request->get('page_id', 0);
$position = $this->request->get('position', '');
$template = $this->request->get('template', '');
$tpls = cmsCore::getTemplates();
if (!$template || !in_array($template, $tpls)) {
$template = cmsConfig::get('template');
}
$widgets_model = cmsCore::getModel('widgets');
$widget = $widgets_model->getWidget($widget_id);
$binded_id = $widgets_model->addWidgetBinding($widget, $page_id, $position, $template);
$bind_widget = $widgets_model->getWidgetBinding($binded_id);
cmsCore::loadWidgetLanguage($bind_widget['name'], $bind_widget['controller']);
$form = cmsCore::getWidgetOptionsForm($bind_widget['name'], $bind_widget['controller'], false, $bind_widget['template']);
$data = $form->parse(new cmsRequest($bind_widget));
$widgets_model->updateWidgetBinding($binded_id, $data);
$this->cms_template->renderJSON(array('error' => !(bool) $binded_id, 'id' => $binded_id));
}
示例4: run
public function run()
{
if (!$this->request->isAjax()) {
cmsCore::error404();
}
if (!$this->request->has('id')) {
cmsCore::error404();
}
$template = cmsTemplate::getInstance();
$widgets_model = cmsCore::getModel('widgets');
$widget_id = $this->request->get('id');
$widget = $widgets_model->getWidgetBinding($widget_id);
cmsCore::loadWidgetLanguage($widget['name'], $widget['controller']);
$form = cmsCore::getWidgetOptionsForm($widget['name'], $widget['controller'], false);
$widget = $form->parse($this->request, true);
$errors = $form->validate($this, $widget);
if (!$errors) {
$widgets_model->updateWidgetBinding($widget_id, $widget);
$template->renderJSON(array('errors' => false, 'callback' => 'widgetUpdated'));
}
if ($errors) {
$template->renderJSON(array('errors' => $errors));
}
}