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


PHP ParserFactory::getParser方法代码示例

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


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

示例1: display

 function display($preview = false)
 {
     $packageName = !empty($_REQUEST['view_package']) ? $_REQUEST['view_package'] : null;
     $subpanelName = !empty($_REQUEST['subpanel']) ? $_REQUEST['subpanel'] : null;
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $packageName, $subpanelName);
     /* BEGIN - SECURITY GROUPS */
     $groupLayout = "";
     if (!empty($_REQUEST['grpLayout'])) {
         $groupLayout = $_REQUEST['grpLayout'];
     }
     global $groupName;
     $groupName = "Default";
     if (!isset($groupLayout) || empty($groupLayout)) {
         $groupLayout = "";
     } else {
         //Get group name for display
         require_once 'modules/SecurityGroups/SecurityGroup.php';
         $groupFocus = new SecurityGroup();
         $groupFocus->retrieve($groupLayout);
         $groupName = $groupFocus->name;
     }
     /* END - SECURITY GROUPS */
     $smarty = $this->constructSmarty($parser);
     //SECURITY GROUPS
     $smarty->assign('grpLayout', $groupLayout);
     if ($preview) {
         echo $smarty->fetch("modules/ModuleBuilder/tpls/Preview/listView.tpl");
     } else {
         $ajax = $this->constructAjax();
         $ajax->addSection('center', $this->translatedViewType, $smarty->fetch("modules/ModuleBuilder/tpls/listView.tpl"));
         echo $ajax->getJavascript();
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:34,代码来源:view.listview.php

示例2: display

 function display()
 {
     $this->parser = ParserFactory::getParser(MB_PORTAL . strtolower($this->editLayout), $this->editModule, null, null, MB_PORTAL);
     $smarty = new Sugar_Smarty();
     //Add in the module we are viewing to our current mod strings
     global $mod_strings, $current_language;
     $editModStrings = return_module_language($current_language, $this->editModule);
     $mod_strings = sugarArrayMerge($editModStrings, $mod_strings);
     $smarty->assign('mod', $mod_strings);
     $smarty->assign('MOD', $mod_strings);
     // assign buttons
     $images = array('icon_save' => 'studio_save', 'icon_publish' => 'studio_publish', 'icon_address' => 'icon_Address', 'icon_emailaddress' => 'icon_EmailAddress', 'icon_phone' => 'icon_Phone');
     foreach ($images as $image => $file) {
         $smarty->assign($image, SugarThemeRegistry::current()->getImage($file, '', null, null, '.gif', $file));
     }
     $smarty->assign('icon_delete', SugarThemeRegistry::current()->getImage('icon_Delete', '', 48, 48, '.gif', $mod_strings['LBL_MB_DELETE']));
     $buttons = array();
     $buttons[] = array('id' => 'saveBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_save'], '', null, null, '.gif', $mod_strings['LBL_BTN_SAVE']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVE'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handleSave();'");
     $buttons[] = array('id' => 'publishBtn', 'image' => SugarThemeRegistry::current()->getImage($images['icon_publish'], '', null, null, '.gif', $mod_strings['LBL_BTN_PUBLISH']), 'text' => $GLOBALS['mod_strings']['LBL_BTN_SAVEPUBLISH'], 'actionScript' => "onclick='if(Studio2.checkCalcFields(\"{$_REQUEST['view']}\", \"ERROR_CALCULATED_PORTAL_FIELDS\"))Studio2.handlePublish();'");
     $html = "";
     foreach ($buttons as $button) {
         if ($button['id'] == "spacer") {
             $html .= "<td style='width:{$button['width']}'> </td>";
         } else {
             $html .= "<td><input id='{$button['id']}' type='button' valign='center' class='button' style='cursor:pointer' " . "onmousedown='this.className=\"buttonOn\";return false;' onmouseup='this.className=\"button\"' " . "onmouseout='this.className=\"button\"' {$button['actionScript']} value = '{$button['text']}' ></td>";
         }
     }
     $smarty->assign('buttons', $html);
     // assign fields and layout
     $smarty->assign('available_fields', $this->parser->getAvailableFields());
     $smarty->assign('field_defs', $this->parser->getFieldDefs());
     $smarty->assign('layout', $this->parser->getLayout());
     $smarty->assign('view_module', $this->editModule);
     $smarty->assign('calc_field_list', json_encode($this->parser->getCalculatedFields()));
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('maxColumns', $this->parser->getMaxColumns());
     $smarty->assign('fieldwidth', '150px');
     $smarty->assign('translate', true);
     $smarty->assign('fromPortal', true);
     // flag for form submittal - when the layout is submitted the actions are the same for layouts and portal layouts, but the parsers must be different...
     if (!empty($this->parser->usingWorkingFile)) {
         $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_LAYOUT_PREVIEW']);
     } else {
         $smarty->assign('layouttitle', $GLOBALS['mod_strings']['LBL_CURRENT_LAYOUT']);
     }
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
     $ajax->addCrumb(translate('LBL_LAYOUTS', 'ModuleBuilder'), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&layout=1")');
     $ajax->addCrumb(ucwords(translate('LBL_MODULE_NAME', $this->editModule)), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&portal=1&view_module=' . $this->editModule . '")');
     $ajax->addCrumb(ucwords($this->editLayout), '');
     // set up language files
     $smarty->assign('language', $this->parser->getLanguage());
     // for sugar_translate in the smarty template
     //navjeet- assistant logic has changed
     //include('modules/ModuleBuilder/language/en_us.lang.php');
     //$smarty->assign('assistantBody', $mod_strings['assistantHelp']['module']['editView'] );
     $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_EDIT_LAYOUT'], $smarty->fetch('modules/ModuleBuilder/tpls/layoutView.tpl'));
     echo $ajax->getJavascript();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:59,代码来源:view.portallayoutview.php

示例3: setUp

 public function setUp()
 {
     require 'include/modules.php';
     $GLOBALS['beanList'] = $beanList;
     $GLOBALS['beanFiles'] = $beanFiles;
     $GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $this->_parser = ParserFactory::getParser('EditView', 'Accounts');
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:9,代码来源:Bug10329Test.php

示例4: display

 function display($preview = false)
 {
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $this->editPackage);
     $smarty = $this->constructSmarty($parser);
     if ($preview) {
         echo $smarty->fetch("modules/ModuleBuilder/tpls/Preview/listView.tpl");
     } else {
         $ajax = $this->constructAjax();
         $ajax->addSection('center', translate('LBL_DASHLET'), $smarty->fetch("modules/ModuleBuilder/tpls/listView.tpl"));
         echo $ajax->getJavascript();
     }
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:13,代码来源:view.dashlet.php

示例5: removeAllCreatedFields

 public static function removeAllCreatedFields()
 {
     foreach (self::$_fieldsAdded as $module_name => $views) {
         foreach ($views as $view => $fields) {
             $parser = ParserFactory::getParser($view, $module_name);
             foreach ($fields as $field_name) {
                 $parser->removeField($field_name);
             }
             $parser->handleSave(false);
             unset($parser);
         }
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:13,代码来源:SugarTestStudioUtilities.php

示例6: display

 function display()
 {
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser(MB_PORTALLISTVIEW, $this->editModule, null, null, MB_PORTAL);
     $smarty = $this->constructSmarty($parser);
     $smarty->assign('fromPortal', true);
     // flag for form submittal - when the layout is submitted the actions are the same for layouts and portal layouts, but the parsers must be different...
     //Override the list view buttons to remove references to the history feature as the portal editors do not support it.
     $buttons = array(array('id' => 'savebtn', 'name' => 'savebtn', 'text' => translate('LBL_BTN_SAVEPUBLISH'), 'actionScript' => "onclick='studiotabs.generateGroupForm(\"edittabs\");" . "if (countListFields()==0) ModuleBuilder.layoutValidation.popup() ; else ModuleBuilder.handleSave(\"edittabs\" )'"));
     $smarty->assign('buttons', $this->_buildImageButtons($buttons));
     $ajax = $this->constructAjax();
     $ajax->addSection('center', translate('LBL_EDIT_LAYOUT', 'ModuleBuilder'), $smarty->fetch("modules/ModuleBuilder/tpls/listView.tpl"));
     echo $ajax->getJavascript();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:14,代码来源:view.portallistview.php

示例7: display

 function display()
 {
     $this->layout = strtolower($_REQUEST['view']);
     $subpanelName = null;
     if (strtolower($this->layout) == 'listview' && !empty($_REQUEST['subpanel'])) {
         $subpanelName = $_REQUEST['subpanel'];
     }
     $packageName = isset($_REQUEST['view_package']) && strtolower($_REQUEST['view_package']) != 'studio' ? $_REQUEST['view_package'] : null;
     $this->module = $_REQUEST['view_module'];
     $this->parser = ParserFactory::getParser($this->layout, $this->module, $packageName, $subpanelName);
     $this->history = $this->parser->getHistory();
     $action = !empty($_REQUEST['histAction']) ? $_REQUEST['histAction'] : 'browse';
     $GLOBALS['log']->debug(get_class($this) . "->display(): performing History action {$action}");
     $this->{$action}();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:15,代码来源:view.history.php

示例8: display

 function display($preview = false)
 {
     $packageName = !empty($_REQUEST['view_package']) ? $_REQUEST['view_package'] : null;
     $subpanelName = !empty($_REQUEST['subpanel']) ? $_REQUEST['subpanel'] : null;
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $packageName, $subpanelName);
     $smarty = $this->constructSmarty($parser);
     if ($preview) {
         echo $smarty->fetch("modules/ModuleBuilder/tpls/Preview/listView.tpl");
     } else {
         $ajax = $this->constructAjax();
         $ajax->addSection('center', $this->translatedViewType, $smarty->fetch("modules/ModuleBuilder/tpls/listView.tpl"));
         echo $ajax->getJavascript();
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:15,代码来源:view.listview.php

示例9: display

 function display($preview = false)
 {
     $packageName = isset($_REQUEST['view_package']) ? $_REQUEST['view_package'] : '';
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($this->editLayout, $this->editModule, $packageName);
     $smarty = parent::constructSmarty($parser);
     $smarty->assign('action', 'searchViewSave');
     $smarty->assign('view', $this->editLayout);
     $smarty->assign('helpName', 'searchViewEditor');
     $smarty->assign('helpDefault', 'modify');
     if ($preview) {
         echo $smarty->fetch("modules/ModuleBuilder/tpls/Preview/listView.tpl");
     } else {
         $ajax = $this->constructAjax();
         $ajax->addSection('center', translate($this->title), $smarty->fetch("modules/ModuleBuilder/tpls/listView.tpl"));
         echo $ajax->getJavascript();
     }
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:18,代码来源:view.searchview.php

示例10: run

 /**
  * Upgrade Task to Run
  */
 public function run()
 {
     if (version_compare($this->from_version, '7.0.0', '<') && $this->toFlavor('ent')) {
         $settings = Opportunity::getSettings();
         if ($settings['opps_view_by'] !== 'RevenueLineItems') {
             $this->log('Not using Revenue Line Items; Skipping Upgrade Script');
             return;
         }
         $fields = array('sales_stage', 'probability', 'commit_stage');
         require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
         $this->log('Processing Opportunity RecordView');
         $recordViewDefsParser = ParserFactory::getParser(MB_RECORDVIEW, 'Opportunities', null, null, 'base');
         if ($this->removeFields($recordViewDefsParser, $fields)) {
             $recordViewDefsParser->handleSave(false);
         }
         $this->log('Processing Opportunity ListView');
         $recordViewDefsParser = ParserFactory::getParser(MB_LISTVIEW, 'Opportunities', null, null, 'base');
         if ($this->removeFields($recordViewDefsParser, $fields)) {
             $recordViewDefsParser->handleSave(false);
         }
         $modules = array('Accounts', 'Contacts', 'Campaigns', 'Documents');
         global $modInvisList;
         if (array_search('Project', $modInvisList)) {
             $modules[] = 'Project';
         }
         foreach ($modules as $module) {
             $this->log('Processing Opportunity SubPanel for ' . $module . ' module');
             if (isModuleBWC($module)) {
                 require_once 'modules/ModuleBuilder/parsers/views/SubpanelMetaDataParser.php';
                 $pf = new SubpanelMetaDataParser('opportunities', $module);
             } else {
                 $pf = ParserFactory::getParser(MB_LISTVIEW, $module, null, 'opportunities');
             }
             if ($this->removeFields($pf, $fields)) {
                 $pf->handleSave(false);
             }
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:42,代码来源:7_OpportunityRemoveHiddenEntFields.php

示例11: addNewFieldsToLayout

 /**
  * Walk through default record view lookng for fields that did not exist on the original pre-sidecar layout defs
  * Any such fields should be appended to the final defs
  *
  * @param array $newDefs
  * @param array $defaultDefs
  */
 protected function addNewFieldsToLayout(array $newDefs)
 {
     $defaultDefs = $this->loadDefaultMetadata();
     $parser = ParserFactory::getParser($this->viewtype, $this->module, $this->package, null, $this->client);
     $defaultFields = $parser->getFieldsFromPanels($defaultDefs['panels'], $parser->_fielddefs);
     $currentFields = $parser->getFieldsFromPanels($newDefs['panels'], $parser->_fielddefs);
     $origFields = array();
     foreach ($this->originalLegacyViewdefs as $lViewtype => $data) {
         // We will need a parser no matter what
         if ($this->sidecar) {
             $legacyParser = ParserFactory::getParser($lViewtype, $this->module, $this->package, null, $this->client);
         } else {
             $legacyParser = ParserFactory::getParser($lViewtype, $this->module, $this->package);
         }
         // replace viewdefs with defaults, since parser's viewdefs can be already customized by other parts
         // of the upgrade
         $legacyParser->_viewdefs['panels'] = $legacyParser->convertFromCanonicalForm($data['panels'], $legacyParser->_fielddefs);
         // get field list
         $origData = $legacyParser->getFieldsFromPanels($data['panels'], $legacyParser->_fielddefs);
         $origFields = array_merge($origFields, $origData);
     }
     //Add fields always defaults to the bottom of the first panel.
     //In this case the 'first panel' is the first non-header panel, AKA panel[1]
     if (empty($newDefs['panels'][1]['fields'])) {
         $this->logUpgradeStatus("Unable to find panels to add to");
     }
     foreach ($defaultFields as $field => $def) {
         // If the special field was not present on legacy layout we shouldn't add it.
         if ($this->isSpecialFieldBySidecarName($field) && empty($currentFields[$field])) {
             continue;
         }
         //If a field wasn't on the lagacy layout, add it to the custom one.
         if (empty($origFields[$field]) && empty($currentFields[$field]) && !empty($newDefs['panels'][1]['fields'])) {
             $newDefs['panels'][1]['fields'][] = $def;
         }
     }
     return $newDefs;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:45,代码来源:SidecarMergeGridMetaDataUpgrader.php

示例12: array_keys

 }
 //If we have metadata files to alter
 if (!empty($module_entries)) {
     $modules = array_keys($module_entries);
     $views = array('basic_search', 'advanced_search', 'detailview', 'editview', 'quickcreate');
     $class_names = array();
     require_once 'include/TemplateHandler/TemplateHandler.php';
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     foreach ($modules as $module) {
         if (isset($GLOBALS['beanList'][$module])) {
             $class_names[] = $GLOBALS['beanList'][$module];
         }
         $repairClass->module_list[] = $module;
         foreach ($views as $view) {
             try {
                 $parser = ParserFactory::getParser($view, $module);
             } catch (Exception $e) {
                 $GLOBALS['log']->fatal("Caught exception in RepairFieldCasing script: " . $e->getMessage());
                 continue;
             }
             if (isset($parser->_viewdefs['panels'])) {
                 foreach ($parser->_viewdefs['panels'] as $panel_id => $panel) {
                     foreach ($panel as $row_id => $row) {
                         foreach ($row as $entry_id => $entry) {
                             if (is_array($entry) && isset($entry['name'])) {
                                 $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
                             }
                         }
                     }
                 }
             } else {
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:RepairFieldCasing.php

示例13: action_dashletSave

 function action_dashletSave()
 {
     $this->view = 'dashlet';
     $packageName = isset($_REQUEST['view_package']) && strtolower($_REQUEST['view_package']) != 'studio' ? $_REQUEST['view_package'] : null;
     require_once 'modules/ModuleBuilder/parsers/ParserFactory.php';
     $parser = ParserFactory::getParser($_REQUEST['view'], $_REQUEST['view_module'], $packageName);
     $parser->handleSave();
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:8,代码来源:controller.php

示例14: removeFieldFromLayouts

 function removeFieldFromLayouts($fieldName)
 {
     // hardcoded list of types for now, as also hardcoded in a different form in getNodes
     // TODO: replace by similar mechanism to StudioModule to determine the list of available views for this module
     $views = array('editview', 'detailview', 'listview', 'basic_search', 'advanced_search', 'dashlet', 'popuplist');
     foreach ($views as $type) {
         $parser = ParserFactory::getParser($type, $this->name, $this->package);
         if ($parser->removeField($fieldName)) {
             $parser->handleSave(false);
         }
         // don't populate from $_REQUEST, just save as is...
     }
     //Remove the fields in subpanel
     $psubs = $this->getProvidedSubpanels();
     foreach ($psubs as $sub) {
         $parser = ParserFactory::getParser(MB_LISTVIEW, $this->name, $this->package, $sub);
         if ($parser->removeField($fieldName)) {
             $parser->handleSave(false);
         }
     }
 }
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:21,代码来源:MBModule.php

示例15: action_copyLayout

 public function action_copyLayout()
 {
     $module = $_REQUEST['view_module'];
     $view = $_REQUEST['view'];
     $role = $_REQUEST['role'];
     $source = $_REQUEST['source'];
     $sourceParser = ParserFactory::getParser($view, $module, null, null, null, array('role' => $source));
     $sourceImplementation = $sourceParser->getImplementation();
     $fileName = $sourceImplementation->getFileNameNoDefault($view, $module);
     if (!file_exists($fileName)) {
         return;
     }
     $parser = ParserFactory::getParser($view, $module, null, null, null, array('role' => $role));
     $history = $parser->getHistory();
     $history->savePreview($fileName);
     $this->view = 'layoutview';
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:17,代码来源:controller.php


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