public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = Arr::merge($baseConfig, $testConfig);
     $serviceManager = new ServiceManager(new ServiceManagerConfig());
     $serviceManager->setService('ApplicationConfig', $config);
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
     static::$config = $config;
 }
 public function addParsedConfig(array $a)
 {
     $parsedFormConfig = $this->getParsedFormConfig();
     if ($parsedFormConfig === null) {
         $parsedFormConfig = new ParsedFormConfig();
     }
     $conf = $parsedFormConfig->toArray();
     $newConf = Arr::merge($conf, $a);
     $parsedFormConfig->exchangeArray($newConf);
     return $this->setParsedFormConfig($parsedFormConfig);
 }
 public function update(\SplSubject $subject)
 {
     /** @var ModelConfigParser $subject */
     $this->setSubject($subject);
     $modelConfig = $subject->getModelConfig();
     $config = [];
     // process fields
     foreach ($modelConfig->fields as $field_name => $field_conf) {
         $config = Arr::merge($config, $this->createField($field_name, $field_conf));
     }
     $subject->addParsedConfig($config);
 }
 /**
  * Returns array with all registered models names
  *
  * @return array
  */
 public function getAllModelNames($scope = null)
 {
     $models = ['custom' => ['Lead', 'Patient', 'Account', 'Document', 'Product', 'Pricebook', 'PricebookDetail', 'Activity', 'Quote', 'QuoteDetail', 'Order', 'OrderDetail', 'Invoice', 'InvoiceDetail', 'Payment', 'EventLog', 'Doctor', 'CardPatient', 'CardLead', 'Note', 'NoteLead', 'NotePatient', 'Call', 'Task', 'Event', 'Vendor'], 'system' => ['User', 'Mail', 'Test', 'EmailToMail', 'Acl', 'MainUser', 'MainCompany', 'MainDb', 'User', 'SaUrl', 'Role', 'Mail', 'MailDetail', 'MailReceiveSetting', 'MailSendSetting', 'Email0', 'Email', 'EventLog']];
     if ($scope !== null && $scope === 'all') {
         $result = $models['custom'];
         $result = Arr::merge($result, $models['system']);
         return $result;
     }
     if ($scope == null || !isset($models[$scope])) {
         $result = $models['custom'];
         $result[] = 'User';
         $result[] = 'Mail';
         return $result;
     }
     return $models[$scope];
 }
 public function s(FieldConfigInterface $conf, FieldTypeInterface $_fieldType)
 {
     $_fieldSets = [];
     $_joins = [];
     $_fieldType->label = isset($conf->label) ? $conf->label : ucfirst($this->getName());
     if (isset($conf->group)) {
         $_fieldSets[$conf->group]['elements'][$this->getName()] = $_fieldType->label;
         $_fieldType->group = $conf->group;
     }
     //FIXME this does not work for lookup fields, only for source fields. Need update.
     $_fieldType->default = isset($conf->default) ? $conf->default : '';
     $_fieldType->source = $this->getName();
     $_fields = [$this->getName() => $_fieldType->toArray()];
     $_labels = [$this->getName() => $_fieldType->label];
     $_fields = Arr::merge($_fields, [$this->getName() . '_id' => ['type' => 'field', 'fieldtype' => 'source', 'datatype' => 'string', 'default' => 0, 'label' => '']]);
     $result = ['labels' => $_labels, 'fields' => $_fields, 'joins' => $_joins, 'fieldsets' => $_fieldSets];
     return $result;
 }
 public function setOrder(array $order)
 {
     $this->_order = Arr::merge($this->_order, $order);
     return $this;
 }
Beispiel #7
0
 public function setData(array $data)
 {
     $this->_data = Arr::merge($this->_data, $data);
 }
 /**
  * @return $this|void
  * @throws \Exception
  */
 public function process()
 {
     $this->setDataFields();
     $params = [];
     foreach ($this->getViewBoxConfigVerify()->blocks as $blockName => $viewNames) {
         foreach ($viewNames as $viewName) {
             $modelView = $this->getViewServiceVerify()->get($viewName);
             $modelView->setParams($this->getParamsVerify());
             $modelView->process();
             if (!$modelView->isAllowed()) {
                 continue;
             }
             if ($modelView->hasRedirect()) {
                 $this->setRedirect($modelView->getRedirect());
                 return;
             }
             if ($modelView->hasResponse()) {
                 $this->setResponse($modelView->getResponse());
                 return;
             }
             $data = $modelView->getData();
             $vParams = Arr::getDoubtField($data, 'params', []);
             if (count($vParams)) {
                 $params = Arr::merge($params, $vParams);
             }
             $viewResults = ['data' => [$blockName => [$viewName => $modelView->getData()]]];
             $this->setData($viewResults);
         }
     }
     $params['data'] = strtolower($this->getViewBoxConfigVerify()->document);
     $params['view'] = strtolower($this->getViewBoxConfigVerify()->mode);
     $this->setData(['viewboxparams' => $params, 'user' => $this->getAuthServiceVerify()->getUser()]);
     return $this;
 }
 public function addParsedConfig(array $a)
 {
     return $this->setParsedFieldConfig(Arr::merge($this->getParsedFieldConfig(), $a));
 }