Example #1
0
 /**
  * Enter description here...
  *
  * Matches single (scalar) or multiple (array) search terms against a
  * number of fields.  Generally, the term(s) are enclosed in percent
  * signs ("%term%"), so any fields that contain them will match.
  * However, if the search parameter is a string and does contain a percent
  * sign already, none will be added to the query.
  * This allows searches using custom patterns, like "fields beginning
  * with "a" ("a%").
  * (You might even want to extend this to work with arrays, too.
  * Currently, only the shop module uses this feature.) -- RK 20100910
  * @param   mixed     $search       The term or array of terms
  * @param unknown_type $core
  * @param unknown_type $attributeId
  * @return  array                   The array of SQL snippets
  */
 protected function parseAttributeSearchConditions($search, $core = false, $attributeId = 0)
 {
     $arrConditions = array();
     $pattern = array();
     if (empty($this->objAttribute)) {
         $this->initAttributes();
     }
     $objParentAttribute = $this->objAttribute->getById($attributeId);
     if ($core) {
         $attributeKeyClausePrefix = '';
         $attributeKeyClauseSuffix = '';
     } else {
         $attributeValueColumn = 'tblA.`value`';
     }
     foreach ($objParentAttribute->{'get' . ($core ? 'Core' : 'Custom') . 'AttributeIds'}() as $attributeId) {
         $objAttribute = $objParentAttribute->getById($attributeId);
         if ($core) {
             $attributeValueColumn = 'tblP.`' . $objAttribute->getId() . '`';
         } else {
             $attributeKeyClausePrefix = '(tblA.`attribute_id` = ' . $objAttribute->getId() . ' AND ';
             $attributeKeyClauseSuffix = ')';
         }
         switch ($objAttribute->getType()) {
             case 'text':
             case 'mail':
             case 'uri':
             case 'image':
                 switch ($objAttribute->getDataType()) {
                     case 'int':
                         $arrConditions[] = $attributeKeyClausePrefix . '(' . $attributeValueColumn . ' = ' . (is_array($search) ? implode(' OR ' . $attributeValueColumn . ' = ', array_map('intval', $search)) : intval($search)) . ')' . $attributeKeyClauseSuffix;
                         break;
                     case 'string':
                         $percent = '%';
                         if (!is_array($search) && strpos('%', $search) !== false) {
                             $percent = '';
                         }
                         $arrConditions[] = $attributeKeyClausePrefix . "(" . $attributeValueColumn . " LIKE '{$percent}" . (is_array($search) ? implode("{$percent}' OR " . $attributeValueColumn . " LIKE '{$percent}", array_map('addslashes', $search)) : addslashes($search)) . "{$percent}')" . $attributeKeyClauseSuffix;
                         break;
                     default:
                         break 2;
                 }
                 break;
             case 'menu':
                 $arrMatchedChildren = array();
                 foreach ($objAttribute->getChildren() as $childAttributeId) {
                     $objChildAttribute = $objAttribute->getById($childAttributeId);
                     if (is_array($search)) {
                         foreach ($search as $name) {
                             if (stristr($objChildAttribute->getName(), $name)) {
                                 $arrMatchedChildren[] = in_array($attributeId, array('title', 'country')) ? preg_match('#([0-9]+)#', $childAttributeId, $pattern) ? $pattern[0] : 0 : $childAttributeId;
                                 break;
                             }
                         }
                     } elseif (stristr($objChildAttribute->getName(), $search)) {
                         $arrMatchedChildren[] = in_array($attributeId, array('title', 'country')) ? preg_match('#([0-9]+)#', $childAttributeId, $pattern) ? $pattern[0] : 0 : $childAttributeId;
                     }
                 }
                 if (count($arrMatchedChildren)) {
                     $arrConditions[] = $attributeKeyClausePrefix . "(" . $attributeValueColumn . " = '" . implode("' OR " . $attributeValueColumn . " = '", $arrMatchedChildren) . "')" . $attributeKeyClauseSuffix;
                 }
                 break;
                 /*case 'frame':
                                 case 'history':
                                     foreach ($objAttribute->getChildren() as $childAttributeId) {
                                         $arrConditions = array_merge($arrConditions, $this->parseAttributeSearchConditions($search, $core, $childAttributeId));
                                     }
                                     break;
                 
                                 case 'group':
                                     foreach ($objAttribute->getChildren() as $childAttributeId) {
                                         $arrConditions = array_merge($arrConditions, $this->parseAttributeSearchConditions($search, $core, $childAttributeId));
                                     }
                                     break;*/
             /*case 'frame':
                             case 'history':
                                 foreach ($objAttribute->getChildren() as $childAttributeId) {
                                     $arrConditions = array_merge($arrConditions, $this->parseAttributeSearchConditions($search, $core, $childAttributeId));
                                 }
                                 break;
             
                             case 'group':
                                 foreach ($objAttribute->getChildren() as $childAttributeId) {
                                     $arrConditions = array_merge($arrConditions, $this->parseAttributeSearchConditions($search, $core, $childAttributeId));
                                 }
                                 break;*/
             default:
                 // TODO: What is this good for?
                 continue 2;
                 break;
         }
     }
     return $arrConditions;
 }
Example #2
0
 /**
  * Display a section of settings present in the $arrSettings class array
  *
  * See the description of {@see show()} for details.
  * @param   \Cx\Core\Html\Sigma $objTemplateLocal   The Template object,
  *                                                  by reference
  * @param   string              $section      The optional section header
  *                                            text to add
  * @param   string              $prefix       The optional prefix for
  *                                            language variables.
  *                                            Defaults to 'TXT_'
  * @return  boolean                           True on success, false otherwise
  */
 static function show_section(&$objTemplateLocal, $section = '', $prefix = 'TXT_', $readOnly = false)
 {
     global $_ARRAYLANG, $_CORELANG;
     $arrSettings = self::getCurrentSettings();
     self::verify_template($objTemplateLocal);
     // This is set to multipart if necessary
     $enctype = '';
     $i = 0;
     if ($objTemplateLocal->blockExists('core_setting_row')) {
         $objTemplateLocal->setCurrentBlock('core_setting_row');
     }
     foreach ($arrSettings as $name => $arrSetting) {
         // Determine HTML element for type and apply values and selected
         $element = '';
         $value = $arrSetting['value'];
         $values = self::splitValues($arrSetting['values']);
         $type = $arrSetting['type'];
         // Not implemented yet:
         // Warn if some mandatory value is empty
         if (empty($value) && preg_match('/_mandatory$/', $type)) {
             \Message::warning(sprintf($_CORELANG['TXT_CORE_SETTING_WARNING_EMPTY'], $_ARRAYLANG[$prefix . strtoupper($name)], $name));
         }
         // Warn if some language variable is not defined
         if (empty($_ARRAYLANG[$prefix . strtoupper($name)])) {
             \Message::warning(sprintf($_CORELANG['TXT_CORE_SETTING_WARNING_MISSING_LANGUAGE'], $prefix . strtoupper($name), $name));
         }
         //DBG::log("Value: $value -> align $value_align");
         switch ($type) {
             // Dropdown menu
             case self::TYPE_DROPDOWN:
                 $matches = null;
                 if (preg_match('/^\\{src:([a-z0-9_\\\\:]+)\\(\\)\\}$/i', $arrSetting['values'], $matches)) {
                     $arrValues = self::splitValues(call_user_func($matches[1]));
                 } else {
                     $arrValues = self::splitValues($arrSetting['values']);
                 }
                 //DBG::log("Values: ".var_export($arrValues, true));
                 $element = \Html::getSelect($name, $arrValues, $value, '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;' . (isset($arrValues[$value]) && is_numeric($arrValues[$value]) ? 'text-align: right;' : '') . '"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
                 break;
             case self::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE:
                 $element = \Html::getSelect($name, User_Profile_Attribute::getCustomAttributeNameArray(), $arrSetting['value'], '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
                 break;
             case self::TYPE_DROPDOWN_USERGROUP:
                 $element = \Html::getSelect($name, UserGroup::getNameArray(), $arrSetting['value'], '', '', 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
                 break;
             case self::TYPE_WYSIWYG:
                 // These must be treated differently, as wysiwyg editors
                 // claim the full width
                 if ($readOnly) {
                     // TODO: this might be dangerous! should be rewritten probably
                     $element = $value;
                 } else {
                     $element = new \Cx\Core\Wysiwyg\Wysiwyg($name, $value);
                 }
                 $objTemplateLocal->setVariable(array('CORE_SETTING_ROW' => $_ARRAYLANG[$prefix . strtoupper($name)], 'CORE_SETTING_ROWCLASS1' => ++$i % 2 ? '1' : '2'));
                 $objTemplateLocal->parseCurrentBlock();
                 $objTemplateLocal->setVariable(array('CORE_SETTING_ROW' => $element . '<br /><br />', 'CORE_SETTING_ROWCLASS1' => ++$i % 2 ? '1' : '2'));
                 $objTemplateLocal->parseCurrentBlock();
                 // Skip the part below, all is done already
                 continue 2;
             case self::TYPE_FILEUPLOAD:
                 //echo("\Cx\Core\Setting\Controller\Setting::show_section(): Setting up upload for $name, $value<br />");
                 $element = \Html::getInputFileupload($name, $value ? $name : false, Filetype::MAXIMUM_UPLOAD_FILE_SIZE, $arrSetting['values'], 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''), true, $value ? $value : 'media/' . (isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : 'other'));
                 // File uploads must be multipart encoded
                 $enctype = 'enctype="multipart/form-data"';
                 break;
             case self::TYPE_BUTTON:
                 // The button is only available to trigger some event.
                 $event = 'onclick=\'' . 'if (confirm("' . $_ARRAYLANG[$prefix . strtoupper($name) . '_CONFIRM'] . '")) {' . 'document.getElementById("' . $name . '").value=1;' . 'document.formSettings_' . self::$tab_index . '.submit();' . '}\'';
                 //DBG::log("\Cx\Core\Setting\Controller\Setting::show_section(): Event: $event");
                 $element = \Html::getInputButton('__' . $name, $_ARRAYLANG[strtoupper($prefix . $name) . '_LABEL'], 'button', false, $event . ($readOnly ? \Html::ATTRIBUTE_DISABLED : '')) . \Html::getHidden($name, 0, '');
                 //DBG::log("\Cx\Core\Setting\Controller\Setting::show_section(): Element: $element");
                 break;
             case self::TYPE_TEXTAREA:
                 $element = \Html::getTextarea($name, $value, 80, 8, $readOnly ? \Html::ATTRIBUTE_DISABLED : '');
                 //                        'style="width: '.self::DEFAULT_INPUT_WIDTH.'px;'.$value_align.'"');
                 break;
             case self::TYPE_CHECKBOX:
                 $arrValues = self::splitValues($arrSetting['values']);
                 $value_true = current($arrValues);
                 $element = \Html::getCheckbox($name, $value_true, false, in_array($value, $arrValues), '', $readOnly ? \Html::ATTRIBUTE_DISABLED : '');
                 break;
             case self::TYPE_CHECKBOXGROUP:
                 $checked = self::splitValues($value);
                 $element = \Html::getCheckboxGroup($name, $values, $values, $checked, '', '', '<br />', $readOnly ? \Html::ATTRIBUTE_DISABLED : '', '');
                 break;
                 // 20120508 UNTESTED!
             // 20120508 UNTESTED!
             case self::TYPE_RADIO:
                 $checked = $value;
                 $element = \Html::getRadioGroup($name, $values, $checked, '', $readOnly ? \Html::ATTRIBUTE_DISABLED : '');
                 break;
             case self::TYPE_PASSWORD:
                 $element = \Html::getInputPassword($name, $value, 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
                 break;
                 //datepicker
             //datepicker
             case self::TYPE_DATE:
                 $element = \Html::getDatepicker($name, array('defaultDate' => $value), 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"');
                 break;
                 //datetimepicker
             //datetimepicker
             case self::TYPE_DATETIME:
                 $element = \Html::getDatetimepicker($name, array('defaultDate' => $value), 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;"');
                 break;
                 // Default to text input fields
             // Default to text input fields
             case self::TYPE_TEXT:
             case self::TYPE_EMAIL:
             default:
                 $element = \Html::getInputText($name, $value, false, 'style="width: ' . self::DEFAULT_INPUT_WIDTH . 'px;' . (is_numeric($value) ? 'text-align: right;' : '') . '"' . ($readOnly ? \Html::ATTRIBUTE_DISABLED : ''));
         }
         //add Tooltip
         $toolTips = '';
         $toolTipsHelp = '';
         if (isset($_ARRAYLANG[$prefix . strtoupper($name) . '_TOOLTIP'])) {
             // generate tooltip for configuration option
             $toolTips = '  <span class="icon-info tooltip-trigger"></span><span class="tooltip-message">' . $_ARRAYLANG[$prefix . strtoupper($name) . '_TOOLTIP'] . '</span>';
         }
         if (isset($_ARRAYLANG[$prefix . strtoupper($name) . '_TOOLTIP_HELP'])) {
             // generate tooltip for configuration option
             $toolTipsHelp = '  <span class="icon-info tooltip-trigger"></span><span class="tooltip-message">' . $_ARRAYLANG[$prefix . strtoupper($name) . '_TOOLTIP_HELP'] . '</span>';
         }
         $objTemplateLocal->setVariable(array('CORE_SETTING_NAME' => (isset($_ARRAYLANG[$prefix . strtoupper($name)]) ? $_ARRAYLANG[$prefix . strtoupper($name)] : $name) . $toolTips, 'CORE_SETTING_VALUE' => $element . $toolTipsHelp, 'CORE_SETTING_ROWCLASS2' => ++$i % 2 ? '1' : '2'));
         $objTemplateLocal->parseCurrentBlock();
         //echo("\Cx\Core\Setting\Controller\Setting::show(objTemplateLocal, $prefix): shown $name => $value<br />");
     }
     // Set form encoding to multipart if necessary
     if (!empty($enctype)) {
         $objTemplateLocal->setVariable('CORE_SETTING_ENCTYPE', $enctype);
     }
     if (!empty($section) && $objTemplateLocal->blockExists('core_setting_section')) {
         //echo("\Cx\Core\Setting\Controller\Setting::show(objTemplateLocal, $header, $prefix): creating section $header<br />");
         $objTemplateLocal->setVariable(array('CORE_SETTING_SECTION' => $section));
         //$objTemplateLocal->parse('core_setting_section');
     }
     return true;
 }
 function _configDeleteAttribute()
 {
     global $_ARRAYLANG, $objDatabase;
     // only administrators are allowed to modify the config
     if (!\Permission::hasAllAccess()) {
         \Permission::noAccess();
     }
     $objAttribute = new \User_Profile_Attribute();
     $attributeId = isset($_REQUEST['id']) ? contrexx_addslashes($_REQUEST['id']) : 0;
     if ($attributeId && $objAttribute->load($attributeId)) {
         if ($objAttribute->delete()) {
             self::$arrStatusMsg['ok'][] = $_ARRAYLANG['TXT_ACCESS_SUCCESS_DEL_ATTRIBUTE'];
             if ($objAttribute->getParent()) {
                 $_REQUEST['id'] = $objAttribute->getParent();
                 return $this->_configModifyAttribute();
             } else {
                 $_REQUEST['id'] = 0;
                 return $this->_configAttributes();
             }
         } else {
             self::$arrStatusMsg['error'][] = $objAttribute->getErrorMsg();
             if ($objAttribute->getParent()) {
                 $_REQUEST['id'] = $objAttribute->getParent();
                 return $this->_configModifyAttribute();
             } else {
                 $_REQUEST['id'] = 0;
                 return $this->_configAttributes();
             }
         }
     } else {
         self::$arrStatusMsg['error'][] = $_ARRAYLANG['TXT_ACCESS_INVALID_PROFILE_ATTRIBUTE_SPECIFIED'];
         $_REQUEST['id'] = 0;
         return $this->_configAttributes();
     }
 }
 /**
  * settings general
  * 
  * @global <type> $objDatabase
  * @global <type> $_ARRAYLANG
  * @return true
  */
 public function showGeneralSettings()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', 'module_' . $this->moduleNameLC . '_settings_general.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_CRM_SETTINGS'];
     $objTpl = $this->_objTpl;
     $objTpl->hideBlock('insufficient-warning');
     if (isset($_POST['save'])) {
         $settings = array('allow_pm' => !$this->isPmInstalled ? 0 : (isset($_POST['allowPm']) ? 1 : 0), 'create_user_account' => isset($_POST['create_user_account']) ? 1 : 0, 'customer_default_language_backend' => isset($_POST['default_language_backend']) ? (int) $_POST['default_language_backend'] : 0, 'customer_default_language_frontend' => isset($_POST['default_language_frontend']) ? (int) $_POST['default_language_frontend'] : 0, 'default_user_group' => isset($_POST['default_user_group']) ? (int) $_POST['default_user_group'] : 0, 'user_account_mantatory' => isset($_POST['user_account_mantatory']) ? 1 : 0, 'emp_default_user_group' => isset($_POST['emp_default_user_group']) ? (int) $_POST['emp_default_user_group'] : 0, 'default_country_value' => isset($_POST['default_country_value']) ? (int) $_POST['default_country_value'] : 0, 'user_profile_attribute_industry_type' => isset($_POST['user_profile_attribute_industry_type']) ? $_POST['user_profile_attribute_industry_type'] : 0, 'user_profile_attribute_company_size' => isset($_POST['user_profile_attribute_company_size']) ? $_POST['user_profile_attribute_company_size'] : 0, 'user_profile_attribute_customer_type' => isset($_POST['user_profile_attribute_customer_type']) ? $_POST['user_profile_attribute_customer_type'] : 0);
         \Cx\Core\Setting\Controller\Setting::init('Crm', 'config');
         // save industry_typ and company_size user profil attribut id
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_industry_type', $settings['user_profile_attribute_industry_type']);
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_company_size', $settings['user_profile_attribute_company_size']);
         \Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_type', $settings['user_profile_attribute_customer_type']);
         \Cx\Core\Setting\Controller\Setting::updateAll();
         foreach ($settings as $settings_var => $settings_val) {
             $updateAllowPm = 'UPDATE ' . DBPREFIX . 'module_' . $this->moduleNameLC . '_settings
                                 SET `setvalue` = "' . contrexx_input2db($settings_val) . '"
                                     WHERE setname = "' . $settings_var . '"';
             $objDatabase->Execute($updateAllowPm);
         }
         $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_CHANGES_UPDATED_SUCCESSFULLY'];
     }
     $settings = $this->getSettings();
     if (isset($settings['emp_default_user_group']) && !empty($settings['emp_default_user_group'])) {
         $groupId = array();
         $groupValidation = $objDatabase->Execute("SELECT group_id FROM " . DBPREFIX . "access_group_static_ids WHERE access_id = {$this->customerAccessId}");
         if ($groupValidation && $groupValidation->RecordCount() > 0) {
             while (!$groupValidation->EOF) {
                 array_push($groupId, (int) $groupValidation->fields['group_id']);
                 $groupValidation->MoveNext();
             }
         }
         if (!in_array($settings['emp_default_user_group'], $groupId)) {
             $objTpl->setVariable('CRM_INSUFFICIENT_WARNING', $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE_ACCESS_ERROR']);
             $objTpl->touchBlock('insufficient-warning');
         }
     }
     if ($settings['create_user_account'] == 1) {
         $this->createProfilAttributes();
     }
     $objLanguages = $objDatabase->Execute("SELECT `id`, `name`, `frontend`, `backend` FROM " . DBPREFIX . "languages WHERE frontend = 1 OR backend =1");
     if ($objLanguages) {
         $objTpl->setVariable(array('CRM_LANG_NAME' => $_ARRAYLANG['TXT_CRM_STANDARD'], 'CRM_LANG_VALUE' => 0, 'CRM_LANG_SELECTED' => $settings['customer_default_language_frontend'] == 0 ? "selected='selected'" : ''));
         $objTpl->parse("langFrontend");
         $objTpl->setVariable(array('CRM_LANG_NAME' => $_ARRAYLANG['TXT_CRM_STANDARD'], 'CRM_LANG_VALUE' => 0, 'CRM_LANG_SELECTED' => $settings['customer_default_language_backend'] == 0 ? "selected='selected'" : ''));
         $objTpl->parse("langBackend");
         while (!$objLanguages->EOF) {
             if ($objLanguages->fields['frontend']) {
                 $objTpl->setVariable(array('CRM_LANG_NAME' => contrexx_raw2xhtml($objLanguages->fields['name']), 'CRM_LANG_VALUE' => (int) $objLanguages->fields['id'], 'CRM_LANG_SELECTED' => $settings['customer_default_language_frontend'] == $objLanguages->fields['id'] ? "selected='selected'" : ''));
                 $objTpl->parse("langFrontend");
             }
             if ($objLanguages->fields['backend']) {
                 $objTpl->setVariable(array('CRM_LANG_NAME' => contrexx_raw2xhtml($objLanguages->fields['name']), 'CRM_LANG_VALUE' => (int) $objLanguages->fields['id'], 'CRM_LANG_SELECTED' => $settings['customer_default_language_backend'] == $objLanguages->fields['id'] ? "selected='selected'" : ''));
                 $objTpl->parse("langBackend");
             }
             $objLanguages->MoveNext();
         }
     }
     $objFWUser = \FWUser::getFWUserObject();
     $objGroupIds = $objFWUser->objGroup->getGroups($filter = array('is_active' => true));
     if ($objGroupIds) {
         while (!$objGroupIds->EOF) {
             $objTpl->setVariable(array('CRM_GROUP_NAME' => contrexx_raw2xhtml($objGroupIds->getName()), 'CRM_GROUP_VALUE' => (int) $objGroupIds->getId(), 'CRM_USER_GROUP_SELECTED' => $settings['default_user_group'] == $objGroupIds->getId() ? "selected='selected'" : ''));
             $objTpl->parse("userGroup");
             $objGroupIds->next();
         }
     }
     //show backend groups
     $objBackendGroupIds = $objFWUser->objGroup->getGroups($filter = array('is_active' => true, 'type' => 'backend'));
     if ($objBackendGroupIds) {
         while (!$objBackendGroupIds->EOF) {
             $objTpl->setVariable(array('CRM_GROUP_NAME' => contrexx_raw2xhtml($objBackendGroupIds->getName()), 'CRM_GROUP_VALUE' => (int) $objBackendGroupIds->getId(), 'CRM_USER_GROUP_SELECTED' => $settings['emp_default_user_group'] == $objBackendGroupIds->getId() ? "selected='selected'" : ''));
             $objTpl->parse("empUserGroup");
             $objBackendGroupIds->next();
         }
     }
     $countries = $this->getCountry();
     foreach ($countries as $key => $value) {
         if ($settings['default_country_value'] == $value['id']) {
             $selected = "selected='selected'";
         } else {
             $selected = '';
         }
         $objTpl->setVariable(array('CRM_DEFAULT_COUNTRY_ID' => (int) $value['id'], 'CRM_DEFAULT_COUNTRY_NAME' => contrexx_raw2xhtml($value['name']), 'CRM_DEFAULT_COUNTRY_SELECTED' => $selected));
         $objTpl->parse("default_country");
     }
     $objTpl->setVariable(array('CRM_ALLOW_PM' => $settings['allow_pm'] ? "checked='checked'" : '', 'CRM_CREATE_ACCOUNT_USER' => $settings['create_user_account'] ? "checked='checked'" : '', 'CRM_ACCOUNT_MANTATORY' => $settings['user_account_mantatory'] ? "checked='checked'" : ''));
     $objTpl->setVariable(array('TXT_CRM_ALLOW_PM' => $_ARRAYLANG["TXT_CRM_ALLOW_PM"], 'TXT_CRM_DEFAULT_COUNTRY' => $_ARRAYLANG["TXT_CRM_DEFAULT_COUNTRY"], 'TXT_CRM_SELECT_COUNTRY' => $_ARRAYLANG["TXT_CRM_SELECT_COUNTRY"], 'TXT_CRM_CUSTOMERS' => $_ARRAYLANG['TXT_CRM_CUSTOMERS'], 'TXT_CRM_LANGUAGE' => $_ARRAYLANG['TXT_CRM_TITLE_LANGUAGE'], 'TXT_CRM_BACKEND' => $_ARRAYLANG['TXT_CRM_BACKEND'], 'TXT_CRM_FRONTEND' => $_ARRAYLANG['TXT_CRM_FRONTEND'], 'TXT_CRM_ALLOW_PM_EXPLANATION' => $_ARRAYLANG["TXT_CRM_ALLOW_PM_EXPLANATION"], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_CRM_DEFAULT_LANGUAGE'], 'TXT_CRM_DEFAULT_USER_GROUP' => $_ARRAYLANG['TXT_CRM_DEFAULT_USER_GROUP'], 'TXT_CRM_CREATE_ACCOUNT_USER' => $_ARRAYLANG['TXT_CRM_CREATE_ACCOUNT_USER'], 'TXT_CRM_CREATE_ACCOUNT_USER_TIP' => $_ARRAYLANG['TXT_CRM_CREATE_ACCOUNT_USER_TIP'], 'TXT_CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE'], 'TXT_CRM_PROFILE_ATTRIBUT_COMPANY_SIZE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_COMPANY_SIZE'], 'TXT_CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE' => $_ARRAYLANG['TXT_CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE'], 'MODULE_NAME' => $this->moduleName, 'TXT_CRM_NOTES' => $_ARRAYLANG['TXT_CRM_NOTES'], 'TXT_CRM_GENERAL' => $_ARRAYLANG['TXT_CRM_GENERAL'], 'TXT_CRM_CURRENCY' => $_ARRAYLANG['TXT_CRM_CURRENCY'], 'TXT_CRM_CUSTOMER_TYPES' => $_ARRAYLANG['TXT_CRM_CUSTOMER_TYPES'], 'TXT_CRM_EMPLOYEE' => $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE'], 'TXT_CRM_EMP_DEFAULT_USER_GROUP' => $_ARRAYLANG['TXT_CRM_EMP_DEFAULT_USER_GROUP'], 'TXT_CRM_SETTINGS_EMP_TOOLTIP' => $_ARRAYLANG['TXT_CRM_SETTINGS_EMPLOYEE_TOOLTIP'], 'TXT_CRM_ACCOUNT_ARE_MANTATORY' => $_ARRAYLANG['TXT_CRM_ACCOUNT_ARE_MANTATORY'], 'CRM_PROFILE_ATTRIBUT_INDUSTRY_TYPE_DROPDOWN' => \Html::getSelect('user_profile_attribute_industry_type', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_industry_type', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"'), 'CRM_PROFILE_ATTRIBUT_COMPANY_SIZE_DROPDOWN' => \Html::getSelect('user_profile_attribute_company_size', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_company_size', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"'), 'CRM_PROFILE_ATTRIBUT_CUSTOMER_TYPE_DROPDOWN' => \Html::getSelect('user_profile_attribute_customer_type', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_type', 'Crm'), '', '', 'tabindex="0" style="width: 270px;"')));
     if (!$this->isPmInstalled) {
         $objTpl->hideBlock('allowPmModule');
     }
 }
Example #5
0
 static function view_settings_general()
 {
     // General settings
     self::$objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_general.html');
     // TODO: Temporary.  Remove in release with working update
     // Returns NULL on missing entries even when other settings are properly loaded
     $test = \Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop');
     if ($test === NULL) {
         ShopSettings::errorHandler();
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     }
     self::$objTemplate->setVariable(array('SHOP_CONFIRMATION_EMAILS' => \Cx\Core\Setting\Controller\Setting::getValue('email_confirmation', 'Shop'), 'SHOP_CONTACT_EMAIL' => \Cx\Core\Setting\Controller\Setting::getValue('email', 'Shop'), 'SHOP_CONTACT_COMPANY' => \Cx\Core\Setting\Controller\Setting::getValue('company', 'Shop'), 'SHOP_CONTACT_ADDRESS' => \Cx\Core\Setting\Controller\Setting::getValue('address', 'Shop'), 'SHOP_CONTACT_TEL' => \Cx\Core\Setting\Controller\Setting::getValue('telephone', 'Shop'), 'SHOP_CONTACT_FAX' => \Cx\Core\Setting\Controller\Setting::getValue('fax', 'Shop'), 'SHOP_GENERAL_COUNTRY_MENUOPTIONS' => \Cx\Core\Country\Controller\Country::getMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('country_id', 'Shop')), 'SHOP_THUMBNAIL_MAX_WIDTH' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_max_width', 'Shop'), 'SHOP_THUMBNAIL_MAX_HEIGHT' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_max_height', 'Shop'), 'SHOP_THUMBNAIL_QUALITY' => \Cx\Core\Setting\Controller\Setting::getValue('thumbnail_quality', 'Shop'), 'SHOP_WEIGHT_ENABLE_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SHOW_PRODUCTS_DEFAULT_OPTIONS' => Products::getDefaultViewMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('show_products_default', 'Shop')), 'SHOP_PRODUCT_SORTING_MENUOPTIONS' => Products::getProductSortingMenuoptions(), 'SHOP_ORDERITEMS_AMOUNT_MAX' => Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_max', 'Shop')), 'SHOP_ORDERITEMS_AMOUNT_MIN' => Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_min', 'Shop')), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()), 'SHOP_SETTING_CART_USE_JS' => \Html::getCheckbox('use_js_cart', 1, false, \Cx\Core\Setting\Controller\Setting::getValue('use_js_cart', 'Shop')), 'SHOP_SETTING_SHOPNAVBAR_ON_ALL_PAGES' => \Html::getCheckbox('shopnavbar_on_all_pages', 1, false, \Cx\Core\Setting\Controller\Setting::getValue('shopnavbar_on_all_pages', 'Shop')), 'SHOP_SETTING_REGISTER' => \Html::getSelectCustom('register', ShopLibrary::getRegisterMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('register', 'Shop')), false, '', 'style="width: 270px;"'), 'SHOP_SETTING_NUMOF_PRODUCTS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_products_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_ORDERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_orders_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_CUSTOMERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_customers_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_MANUFACTURERS_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_manufacturers_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_MAILTEMPLATE_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_COUPON_PER_PAGE_BACKEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_coupon_per_page_backend', 'Shop'), 'SHOP_SETTING_NUMOF_PRODUCTS_PER_PAGE_FRONTEND' => \Cx\Core\Setting\Controller\Setting::getValue('numof_products_per_page_frontend', 'Shop'), 'SHOP_SETTING_USERGROUP_ID_CUSTOMER' => \Html::getSelect('usergroup_id_customer', \UserGroup::getNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USERGROUP_ID_RESELLER' => \Html::getSelect('usergroup_id_reseller', \UserGroup::getNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USER_PROFILE_ATTRIBUTE_CUSTOMER_GROUP_ID' => \Html::getSelect('user_profile_attribute_customer_group_id', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"'), 'SHOP_SETTING_USER_PROFILE_ATTRIBUTE_NOTES' => \Html::getSelect('user_profile_attribute_notes', \User_Profile_Attribute::getCustomAttributeNameArray(), \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop'), '', '', 'tabindex="0" style="width: 270px;"')));
 }