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


PHP SettingsForm::setData方法代码示例

本文整理汇总了PHP中SettingsForm::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP SettingsForm::setData方法的具体用法?PHP SettingsForm::setData怎么用?PHP SettingsForm::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SettingsForm的用法示例。


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

示例1: manage

 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $request =& $this->getRequest();
     switch ($verb) {
         case 'settings':
             $journal = $request->getJournal();
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if ($request->getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = $request->getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if ($request->getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
开发者ID:jalperin,项目名称:ojs,代码行数:61,代码来源:CustomBlockManagerPlugin.inc.php

示例2: manage

 /**
  * Perform management functions
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $pageCrumbs = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'manager'), 'user.role.manager'), array(Request::url(null, 'manager', 'plugins'), __('manager.plugins'), true));
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
开发者ID:reconciler,项目名称:ojs,代码行数:62,代码来源:CustomBlockManagerPlugin.inc.php

示例3: manage

 /**
  * Perform management functions
  */
 function manage($verb, $args)
 {
     $returner = true;
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $pageCrumbs = array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'manager'), 'user.role.manager'));
     $conference =& Request::getConference();
     switch ($verb) {
         case 'enable':
             $this->setEnabled(true);
             break;
         case 'disable':
             $this->setEnabled(false);
             break;
         case 'settings':
             $pageCrumbs[] = array(Request::url(null, null, 'manager', 'plugins'), Locale::translate('manager.plugins'), true);
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $conference->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 //$blocks = is_null($form->getData('blocks'))?array():$form->getData('blocks');
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             $returner = true;
             break;
     }
     $returner = false;
 }
开发者ID:jalperin,项目名称:ocs,代码行数:66,代码来源:CustomBlockManagerPlugin.inc.php


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