/** * Constructor * @param string $view The view type, that is, editview, searchview etc * @param string $moduleName The name of the module to which this view belongs * @param string $packageName If not empty, the name of the package to which this view belongs * @param string $client The client making the request for this parser * @param array $params Additional parser parameters */ public function __construct($view, $moduleName, $packageName = '', $client = '', array $params = array()) { $GLOBALS['log']->debug(get_class($this) . "->__construct( {$view} , {$moduleName} , {$packageName} )"); // set the client $this->client = $client; $view = strtolower($view); $this->FILLER = array('name' => MBConstants::$FILLER['name'], 'label' => translate(MBConstants::$FILLER['label'])); $this->_moduleName = $moduleName; $this->_view = $view; if (empty($packageName)) { require_once 'modules/ModuleBuilder/parsers/views/DeployedMetaDataImplementation.php'; $this->implementation = new DeployedMetaDataImplementation($view, $moduleName, $client, $params); } else { require_once 'modules/ModuleBuilder/parsers/views/UndeployedMetaDataImplementation.php'; $this->implementation = new UndeployedMetaDataImplementation($view, $moduleName, $packageName, $client); } $viewdefs = $this->implementation->getViewdefs(); //if (!isset(self::$variableMap [ $view ])) // self::$variableMap [ $view ] = $view; if (MetaDataFiles::getViewDefVar($view) === null) { MetaDataFiles::setViewDefVar($view, $view); } //if (!isset($viewdefs [ self::$variableMap [ $view ]])){ if (!$this->hasViewVariable($viewdefs, $view)) { sugar_die(get_class($this) . ": incorrect view variable for {$view}"); } $viewdefs = $this->getDefsFromArray($viewdefs, $view); $this->validateMetaData($viewdefs); $this->_viewdefs = $viewdefs; if ($this->getMaxColumns() < 1) { sugar_die(get_class($this) . ": maxColumns=" . $this->getMaxColumns() . " - must be greater than 0!"); } $this->_fielddefs = $this->implementation->getFielddefs(); $this->_standardizeFieldLabels($this->_fielddefs); $this->_viewdefs['panels'] = $this->_convertFromCanonicalForm($this->_viewdefs['panels'], $this->_fielddefs); // put into our internal format $this->_originalViewDef = $this->getFieldsFromLayout($this->implementation->getOriginalViewdefs()); $this->baseViewFields = $this->getFieldsFromLayout($this->implementation->getBaseViewdefs()); // Setup the fieldset member fields. Used by sidecar. $this->setFieldsetMemberFields(); }