/** * set the placeholders for the category view * * @return null */ function showCategoryView() { global $_ARRAYLANG, $_CORELANG; $this->_objTpl->setTemplate($this->pageContent, true, true); // load source code if cmd value is integer if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) { $page = new \Cx\Core\ContentManager\Model\Entity\Page(); $page->setVirtual(true); $page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION); $page->setModule('Calendar'); // load source code $applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page); \LinkGenerator::parseTemplate($applicationTemplate); $this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate); } $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true); $objCategoryManager->getCategoryList(); $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_SEARCH_TERM' => $_ARRAYLANG['TXT_CALENDAR_KEYWORD'], 'TXT_' . $this->moduleLangVar . '_FROM' => $_ARRAYLANG['TXT_CALENDAR_FROM'], 'TXT_' . $this->moduleLangVar . '_TILL' => $_ARRAYLANG['TXT_CALENDAR_TILL'], 'TXT_' . $this->moduleLangVar . '_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_SEARCH' => $_ARRAYLANG['TXT_CALENDAR_SEARCH'], 'TXT_' . $this->moduleLangVar . '_OCLOCK' => $_ARRAYLANG['TXT_CALENDAR_OCLOCK'], $this->moduleLangVar . '_SEARCH_TERM' => isset($_GET['term']) ? contrexx_input2xhtml($_GET['term']) : '', $this->moduleLangVar . '_SEARCH_FROM' => isset($_GET['from']) ? contrexx_input2xhtml($_GET['from']) : '', $this->moduleLangVar . '_SEARCH_TILL' => isset($_GET['till']) ? contrexx_input2xhtml($_GET['till']) : '', $this->moduleLangVar . '_SEARCH_CATEGORIES' => $objCategoryManager->getCategoryDropdown(isset($_GET['catid']) ? intval($_GET['catid']) : 0, 1))); if (isset($this->categoryId)) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory($this->categoryId); $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name)); $this->objEventManager->showEventList($this->_objTpl); $this->_objTpl->parse('categoryList'); } else { foreach ($objCategoryManager->categoryList as $key => $objCategory) { $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $objCategory->id, $this->searchTerm, true, $this->needAuth, true, $this->startPos, $this->numEvents); $objEventManager->getEventList(); $objEventManager->showEventList($this->_objTpl); $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name)); $this->_objTpl->parse('categoryList'); } } }
/** * Get Tasktype Dropdown * * @param Object $objTpl * @param Integer $selectedType * * @global ADO Connection $objDatabase * @global Array $_ARRAYLANG * * @return null */ function taskTypeDropDown($objTpl, $selectedType = 0) { global $objDatabase, $_ARRAYLANG; $objResult = $objDatabase->Execute("SELECT id, name, icon FROM " . DBPREFIX . "module_{$this->moduleNameLC}_task_types WHERE status=1 ORDER BY sorting"); $first = true; while (!$objResult->EOF) { $selected = $selectedType == $objResult->fields['id'] ? "selected" : ''; if ($first || $selectedType == $objResult->fields['id']) { $objTpl->setVariable(array('DEFAULT_CRM_NOTES_TYPE_ID' => (int) $objResult->fields['id'], 'DEFAULT_CRM_NOTES_TYPE' => contrexx_input2xhtml($objResult->fields['name']))); $first = false; } if (!empty($objResult->fields['icon'])) { $icons = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesCrmWebPath() . '/' . contrexx_raw2xhtml($objResult->fields['icon']) . "_24X24.thumb"; } else { $icons = '../modules/Crm/View/Media/task_default.png'; } $objTpl->setVariable(array('TXT_TASKTYPE_ID' => (int) $objResult->fields['id'], 'TXT_TASKTYPE_NAME' => contrexx_input2xhtml($objResult->fields['name']), 'TXT_TASKTYPE_IMAGE' => $icons, 'TXT_TASKTYPE_SELECTED' => $selected)); $objTpl->parse('Tasktype'); $objResult->MoveNext(); } }
/** * Set up the HTML elements for all the Product Attributes of any Product. * * The following types of Attributes are supported: * 0 Dropdown menu, customers may select no (the default) or one option. * 1 Radio buttons, customers need to select one option. * 2 Checkboxes, customers may select no, one or several options. * 3 Dropdown menu, customers need to select one option. * 4 Optional text field * 5 Mandatory text field * 6 Optional file upload field * 7 Mandatory file upload field * Types 1 and 3 are functionally identical, they only differ by * the kind of widget being used. * The individual Product Attributes carry a unique ID enabling the * JavaScript code contained within the Shop page to verify that * all mandatory choices have been made before any Product can * be added to the cart. * @param integer $product_id The Product ID * @param string $formName The name of the HTML form containing * the Product and options * @param integer $cart_id The optional cart Product ID, * null if not applicable. * @param boolean $flagUpload If a product has an upload * Attribute associated with it, * this parameter will be set to true * @return string The string with the HTML code */ static function productOptions($product_id, $formName, $cart_id = null, &$flagUpload = false) { global $_ARRAYLANG; //\DBG::log("productOptions($product_id, $formName, $cart_id, $flagUpload): Entered"); // Semicolon separated list of Attribute name IDs to verify // before the Product is added to the cart $checkOptionIds = ''; // check if the product option block exists in the template if (self::$objTemplate->blockExists('shopProductOptionsRow') && self::$objTemplate->blockExists('shopProductOptionsValuesRow')) { $domId = 0; $count = 0; $arrAttributes = Attributes::getArray($count, null, null, '`ord` ASC', array('product_id' => $product_id)); //\DBG::log("Attributes: ".var_export($arrAttributes, true)); // When there are no Attributes for this Product, hide the // options blocks if (empty($arrAttributes)) { self::$objTemplate->hideBlock('shopProductOptionsRow'); self::$objTemplate->hideBlock('shopProductOptionsValuesRow'); } else { // Loop through the Attribute Names for the Product foreach ($arrAttributes as $attribute_id => $objAttribute) { $mandatory = false; $arrOptions = Attributes::getOptionArrayByAttributeId($attribute_id); $arrRelation = Attributes::getRelationArray($product_id); // This attribute does not apply for this product if (empty($arrRelation)) { continue; } $selectValues = ''; // create head of option menu/checkbox/radiobutton switch ($objAttribute->getType()) { case Attribute::TYPE_CHECKBOX: case Attribute::TYPE_TEXT_OPTIONAL: case Attribute::TYPE_UPLOAD_OPTIONAL: case Attribute::TYPE_TEXTAREA_OPTIONAL: case Attribute::TYPE_EMAIL_OPTIONAL: case Attribute::TYPE_EMAIL_OPTIONAL: case Attribute::TYPE_URL_OPTIONAL: case Attribute::TYPE_DATE_OPTIONAL: case Attribute::TYPE_NUMBER_INT_OPTIONAL: case Attribute::TYPE_NUMBER_FLOAT_OPTIONAL: // No container nor hidden field for optional types break; case Attribute::TYPE_MENU_OPTIONAL: // There is no hidden input field here either, // but the dropdown menu container $selectValues = '<select name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" style="width:180px;">' . "\n" . '<option value="0">' . $objAttribute->getName() . ' ' . $_ARRAYLANG['TXT_CHOOSE'] . "</option>\n"; break; case Attribute::TYPE_RADIOBUTTON: case Attribute::TYPE_TEXT_MANDATORY: case Attribute::TYPE_UPLOAD_MANDATORY: case Attribute::TYPE_TEXTAREA_MANDATORY: case Attribute::TYPE_EMAIL_MANDATORY: case Attribute::TYPE_URL_MANDATORY: case Attribute::TYPE_DATE_MANDATORY: case Attribute::TYPE_NUMBER_INT_MANDATORY: case Attribute::TYPE_NUMBER_FLOAT_MANDATORY: $mandatory = true; // The Attribute name, indicating a mandatory option. $selectValues = '<input type="hidden" id="productOption-' . $product_id . '-' . $attribute_id . '" value="' . $objAttribute->getName() . '" />' . "\n"; // The Attribute verification regex, if applicable $regex = Attribute::getVerificationRegex($objAttribute->getType()); if ($regex != '') { $selectValues .= '<input type="hidden" id="attributeVerification-' . $product_id . '-' . $attribute_id . '" value="' . $regex . '" />' . "\n"; } $checkOptionIds .= "{$attribute_id};"; break; case Attribute::TYPE_MENU_MANDATORY: $selectValues = '<input type="hidden" id="productOption-' . $product_id . '-' . $attribute_id . '" value="' . $objAttribute->getName() . '" />' . "\n" . '<select name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" style="width:180px;">' . "\n" . (count($arrOptions) > 1 ? '<option value="0">' . $objAttribute->getName() . ' ' . $_ARRAYLANG['TXT_CHOOSE'] . "</option>\n" : ''); $checkOptionIds .= "{$attribute_id};"; break; } $i = 0; foreach ($arrOptions as $option_id => $arrOption) { // This option does not apply to this product if (!isset($arrRelation[$option_id])) { continue; } $option_price = ''; $selected = false; // Show the price only if non-zero if ($arrOption['price'] != 0) { $option_price = ' (' . Currency::getCurrencyPrice($arrOption['price']) . ' ' . Currency::getActiveCurrencySymbol() . ')'; } // mark the option value as selected if it was before // and this page was requested from the cart if (isset($cart_id)) { $options = Cart::get_options_array($cart_id, $attribute_id); if (is_array($options) && in_array($option_id, $options)) { $selected = true; } } // create option menu/checkbox/radiobutton switch ($objAttribute->getType()) { case Attribute::TYPE_MENU_OPTIONAL: $selectValues .= '<option value="' . $option_id . '" ' . ($selected ? 'selected="selected"' : '') . ' >' . $arrOption['value'] . $option_price . "</option>\n"; break; case Attribute::TYPE_RADIOBUTTON: $selectValues .= '<input type="radio" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $option_id . '"' . ($selected ? ' checked="checked"' : '') . ' /><label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '"> ' . $arrOption['value'] . $option_price . "</label><br />\n"; break; case Attribute::TYPE_CHECKBOX: $selectValues .= '<input type="checkbox" name="productOption[' . $attribute_id . '][' . $i . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $option_id . '"' . ($selected ? ' checked="checked"' : '') . ' /><label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '"> ' . $arrOption['value'] . $option_price . "</label><br />\n"; break; case Attribute::TYPE_MENU_MANDATORY: $selectValues .= '<option value="' . $option_id . '"' . ($selected ? ' selected="selected"' : '') . ' >' . $arrOption['value'] . $option_price . "</option>\n"; break; case Attribute::TYPE_TEXT_OPTIONAL: case Attribute::TYPE_TEXT_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="text" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $arrOption['value'] . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_EMAIL_OPTIONAL: case Attribute::TYPE_EMAIL_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="text" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $arrOption['value'] . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_URL_OPTIONAL: case Attribute::TYPE_URL_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="text" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $arrOption['value'] . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_DATE_OPTIONAL: case Attribute::TYPE_DATE_MANDATORY: // $option_price = ' '; // Passed by reference $element_id = 'productOption-' . $product_id . '-' . $attribute_id . '-' . $domId; $selectValues .= \Html::getDatepicker('productOption[' . $attribute_id . ']', array('defaultDate' => $arrOption['value']), 'style="width:180px;"', $element_id) . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_NUMBER_INT_OPTIONAL: case Attribute::TYPE_NUMBER_INT_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="text" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $arrOption['value'] . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_NUMBER_FLOAT_OPTIONAL: case Attribute::TYPE_NUMBER_FLOAT_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="text" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" value="' . $arrOption['value'] . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_UPLOAD_OPTIONAL: case Attribute::TYPE_UPLOAD_MANDATORY: // $option_price = ' '; $selectValues .= '<input type="file" name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" style="width:180px;" />' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; case Attribute::TYPE_TEXTAREA_OPTIONAL: case Attribute::TYPE_TEXTAREA_MANDATORY: // $valuePrice = ' '; $selectValues .= '<textarea name="productOption[' . $attribute_id . ']" id="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '" style="width:300px;">' . contrexx_input2xhtml($arrOption['value']) . '</textarea>' . '<label for="productOption-' . $product_id . '-' . $attribute_id . '-' . $domId . '">' . $option_price . "</label><br />\n"; break; } ++$i; ++$domId; } // create foot of option menu/checkbox/radiobutton switch ($objAttribute->getType()) { case Attribute::TYPE_MENU_OPTIONAL: $selectValues .= "</select><br />"; break; case Attribute::TYPE_RADIOBUTTON: $selectValues .= "<br />"; break; case Attribute::TYPE_CHECKBOX: $selectValues .= ""; break; case Attribute::TYPE_MENU_MANDATORY: $selectValues .= "</select><br />"; break; // Set enctype in form if one of these is present // Set enctype in form if one of these is present case Attribute::TYPE_UPLOAD_OPTIONAL: case Attribute::TYPE_UPLOAD_MANDATORY: // Avoid code analyzer warning $flagUpload = true || $flagUpload; break; /* Nothing to to case Attribute::TYPE_TEXT_OPTIONAL: case Attribute::TYPE_TEXT_MANDATORY: case Attribute::TYPE_TEXTAREA_OPTIONAL: case Attribute::TYPE_TEXTAREA_MANDATORY: case Attribute::TYPE_EMAIL_OPTIONAL: case Attribute::TYPE_EMAIL_MANDATORY: case Attribute::TYPE_URL_OPTIONAL: case Attribute::TYPE_URL_MANDATORY: case Attribute::TYPE_DATE_OPTIONAL: case Attribute::TYPE_DATE_MANDATORY: case Attribute::TYPE_NUMBER_INT_OPTIONAL: case Attribute::TYPE_NUMBER_INT_MANDATORY: case Attribute::TYPE_NUMBER_FLOAT_OPTIONAL: case Attribute::TYPE_NUMBER_FLOAT_MANDATORY: */ } $selectValues .= "\n"; self::$objTemplate->setVariable(array('SHOP_PRODCUT_OPTION' => $selectValues, 'SHOP_PRODUCT_OPTION' => $selectValues, 'SHOP_PRODUCT_OPTIONS_NAME' => $objAttribute->getName(), 'SHOP_PRODUCT_OPTIONS_TITLE' => '<a href="javascript:{}" onclick="toggleOptions(' . $product_id . ', this)" title="' . $_ARRAYLANG['TXT_OPTIONS'] . '">' . $_ARRAYLANG['TXT_OPTIONS'] . "</a>\n")); if ($mandatory && self::$objTemplate->blockExists('product_attribute_mandatory')) { self::$objTemplate->touchBlock('product_attribute_mandatory'); } self::$objTemplate->parse('shopProductOptionsValuesRow'); } self::$objTemplate->parse('shopProductOptionsRow'); } } return "return checkProductOption('shopProductForm{$formName}', " . "{$product_id}, '" . substr($checkOptionIds, 0, strlen($checkOptionIds) - 1) . "');"; }
/** * Set the language list page * * @global array * @global ADONewConnection * @global \Cx\Core\Html\Sigma * @return void */ function languageOverview() { global $_ARRAYLANG, $objDatabase; // init vars $i = 0; \JS::activate('cx'); $cxjs = \ContrexxJavascript::getInstance(); $cxjs->setVariable('copyTitle', $_ARRAYLANG['TXT_LANGUAGE_COPY_TITLE'], 'language/lang'); $cxjs->setVariable('copyText', $_ARRAYLANG['TXT_LANGUAGE_COPY_TEXT'], 'language/lang'); $cxjs->setVariable('copySuccess', $_ARRAYLANG['TXT_LANGUAGE_COPY_SUCCESS'], 'language/lang'); $cxjs->setVariable('linkTitle', $_ARRAYLANG['TXT_LANGUAGE_LINK_TITLE'], 'language/lang'); $cxjs->setVariable('linkText', $_ARRAYLANG['TXT_LANGUAGE_LINK_TEXT'], 'language/lang'); $cxjs->setVariable('linkSuccess', $_ARRAYLANG['TXT_LANGUAGE_LINK_SUCCESS'], 'language/lang'); $cxjs->setVariable('warningTitle', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TITLE'], 'language/lang'); $cxjs->setVariable('warningText', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TEXT'], 'language/lang'); $cxjs->setVariable('waitTitle', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TITLE'], 'language/lang'); $cxjs->setVariable('waitText', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TEXT'], 'language/lang'); $cxjs->setVariable('yesOption', $_ARRAYLANG['TXT_YES'], 'language/lang'); $cxjs->setVariable('noOption', $_ARRAYLANG['TXT_NO'], 'language/lang'); $cxjs->setVariable('langRemovalLabel', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LABEL_LANG_REMOVAL'], 'language/lang'); $cxjs->setVariable('langRemovalContent', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LANG_REMOVAL_CONTENT'], 'language/lang'); $this->template->loadTemplateFile('language_langlist.html'); $this->pageTitle = $_ARRAYLANG['TXT_LANGUAGE_LIST']; if (!$this->isInFullMode()) { $this->hideVariables = true; $this->template->hideBlock('extendedTitles'); $this->template->hideBlock('extendedHeaders'); } else { $this->template->touchBlock('extendedTitles'); } //begin language variables $this->template->setVariable(array('TXT_ADD_NEW_LANGUAGE' => $_ARRAYLANG['TXT_ADD_NEW_LANGUAGE'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_CHARSET' => $_ARRAYLANG['TXT_CHARSET'], 'TXT_ADD' => $_ARRAYLANG['TXT_ADD'], 'TXT_LANGUAGE_LIST' => $_ARRAYLANG['TXT_LANGUAGE_LIST'], 'TXT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_SHORT_FORM' => $_ARRAYLANG['TXT_SHORT_FORM'], 'TXT_STANDARD_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACCEPT_CHANGES' => $_ARRAYLANG['TXT_ACCEPT_CHANGES'], 'TXT_REMARK' => $_ARRAYLANG['TXT_REMARK'], 'TXT_ADD_DELETE_LANGUAGE_REMARK' => $_ARRAYLANG['TXT_ADD_DELETE_LANGUAGE_REMARK'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_VALUE' => $_ARRAYLANG['TXT_VALUE'], 'TXT_MODULE' => $_ARRAYLANG['TXT_MODULE'], 'TXT_LANGUAGE' => $_ARRAYLANG['TXT_LANGUAGE'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_VIEW' => $_ARRAYLANG['TXT_VIEW'], 'TXT_CONTROLLED' => $_ARRAYLANG['TXT_CONTROLLED'], 'TXT_OPEN_ISSUE' => $_ARRAYLANG['TXT_OPEN_ISSUE'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES' => $_ARRAYLANG['TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES'], 'TXT_ADMINISTRATION_PAGES' => $_ARRAYLANG['TXT_ADMINISTRATION_PAGES'], 'TXT_WEB_PAGES' => $_ARRAYLANG['TXT_WEB_PAGES'], 'TXT_SECTION' => $_ARRAYLANG['TXT_SECTION'], 'TXT_CORE_FALLBACK' => $_ARRAYLANG['TXT_CORE_FALLBACK'], 'TXT_LANGUAGE_MANAGER_OK' => $_ARRAYLANG['TXT_LANGUAGE_MANAGER_OK'])); $this->template->setGlobalVariable(array('TXT_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_CORE_NONE' => $_ARRAYLANG['TXT_CORE_NONE'], 'CMD' => contrexx_input2xhtml($_GET['cmd']), 'TXT_LANGUAGE_ACTION_COPY' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_COPY'], 'TXT_LANGUAGE_ACTION_LINK' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_LINK'])); //end language variables if ($this->hideVariables == true) { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: none')); } else { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: block')); } $arrLanguages = \FWLanguage::getActiveFrontendLanguages(); $this->template->setVariable('LANGUAGE_MANAGER_ACTIVE_LANGIDS', implode(', ', array_keys($arrLanguages))); $objResult = $objDatabase->Execute("SELECT * FROM " . DBPREFIX . "languages ORDER BY id"); if ($objResult !== false) { while (!$objResult->EOF) { $checked = ""; if ($objResult->fields['is_default'] == "true") { $checked = "checked"; } $status = "<input type='radio' name='langDefaultStatus' onchange='updateCurrent();' value='" . $objResult->fields['id'] . "' {$checked} />"; $checked = ""; if ($objResult->fields['frontend'] == 1) { $checked = "checked"; } $activeStatus = "<input type='checkbox' name='langActiveStatus[" . $objResult->fields['id'] . "]' onchange='updateCurrent();' value='1' {$checked} />"; $checked = ""; if ($objResult->fields['backend'] == 1) { $checked = "checked"; } $selectedLang = ''; switch ($objResult->fields['fallback']) { case '': $this->template->setVariable('NONE_SELECTED', 'selected="selected"'); break; case '0': $this->template->setVariable('LANGUAGE_DEFAULT_SELECTED', 'selected="selected"'); break; default: $selectedLang = $objResult->fields['fallback']; } // set fallback language drop down foreach ($arrLanguages as $langId => $arrLanguage) { $selected = $langId == $selectedLang ? 'selected="selected"' : ''; $this->template->setVariable(array('LANGUAGE_LANG_ID' => $langId, 'LANGUAGE_LANG_OPTION' => contrexx_raw2xhtml($arrLanguage['name']), 'LANGUAGE_OPTION_SELECTED' => $selected)); $this->template->parse('fallbackLanguages'); } $adminStatus = "<input type='checkbox' name='langAdminStatus[" . $objResult->fields['id'] . "]' value='1' {$checked} />"; $this->template->setVariable(array('LANGUAGE_ROWCLASS' => 'row' . ($i++ % 2 + 1), 'LANGUAGE_LANG_ID' => $objResult->fields['id'], 'LANGUAGE_LANG_NAME' => $objResult->fields['name'], 'LANGUAGE_LANG_SHORTNAME' => $objResult->fields['lang'], 'LANGUAGE_LANG_CHARSET' => $objResult->fields['charset'], 'LANGUAGE_LANG_STATUS' => $status, 'LANGUAGE_ACTIVE_STATUS' => $activeStatus, 'LANGUAGE_ADMIN_STATUS' => $adminStatus)); if (!$this->isInFullMode()) { $this->template->hideBlock('extendedOptions'); } $this->template->parse('languageRow'); $objResult->MoveNext(); } } }
/** * create new file or folder * * @param array $params supplied arguments from JsonData-request * @return string */ public function newWithin($params) { global $_ARRAYLANG, $objInit; $_ARRAYLANG = $objInit->loadLanguageData('ViewManager'); if (empty($params['post']['theme']) || empty($params['post']['name'])) { return array('status' => 'error', 'message' => $_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_EMPTY_NAME']); } if ($params['post']['isFolder'] && preg_match('/^\\./', trim($params['post']['name']))) { // folder name should not start with dot(.) return array('status' => 'error', 'reload' => false, 'message' => sprintf($_ARRAYLANG['TXT_THEME_FOLDER_NAME_NOT_ALLOWED'], contrexx_input2xhtml($params['post']['name']))); } $matches = null; preg_match('@{([0-9A-Za-z._-]+)(:([_a-zA-Z][A-Za-z_0-9]*))?}@sm', $params['post']['name'], $matches); if (!empty($matches)) { return array('status' => 'error', 'reload' => false, 'message' => sprintf($_ARRAYLANG['TXT_THEME_NAME_NOT_ALLOWED'], contrexx_input2xhtml($params['post']['newName']))); } // Cannot rename the virtual directory $virtualDirs = array('/' . \Cx\Core\Core\Model\Entity\SystemComponent::TYPE_CORE_MODULE, '/' . \Cx\Core\Core\Model\Entity\SystemComponent::TYPE_MODULE, '/' . \Cx\Core\Core\Model\Entity\SystemComponent::TYPE_CORE); $currentThemeFolderDirPath = \Env::get('cx')->getWebsiteThemesPath() . '/' . $params['post']['theme'] . '/'; // Create the theme folder, if it does not exist if (!\Cx\Lib\FileSystem\FileSystem::exists($currentThemeFolderDirPath)) { if (!\Cx\Lib\FileSystem\FileSystem::make_folder($currentThemeFolderDirPath)) { return array('status' => 'error', 'reload' => false, 'message' => $_ARRAYLANG['TXT_THEME_NEWFILE_FAILED']); } } $newFileName = \Cx\Lib\FileSystem\FileSystem::replaceCharacters($params['post']['name']); if (!\FWValidator::is_file_ending_harmless($newFileName)) { return array('status' => 'error', 'reload' => false, 'message' => sprintf($_ARRAYLANG['TXT_THEME_FILE_EXTENSION_NOT_ALLOWED'], contrexx_input2xhtml($newFileName))); } if (in_array('/' . $newFileName, $virtualDirs)) { return array('status' => 'error', 'reload' => false, 'message' => $_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_VIRTUAL_FOLDER']); } if (!\Cx\Lib\FileSystem\FileSystem::exists($currentThemeFolderDirPath . $newFileName)) { if ($params['post']['isFolder']) { $status = \Cx\Lib\FileSystem\FileSystem::make_folder($currentThemeFolderDirPath . $newFileName); $succesMessage = sprintf($_ARRAYLANG['TXT_THEME_FOLDER_CREATE_SUCCESS'], contrexx_input2xhtml($newFileName)); } else { $status = \Cx\Lib\FileSystem\FileSystem::touch($currentThemeFolderDirPath . $newFileName); $succesMessage = sprintf($_ARRAYLANG['TXT_THEME_FILE_CREATE_SUCCESS'], contrexx_input2xhtml($newFileName)); } if (!$status) { return array('status' => 'error', 'message' => $_ARRAYLANG['TXT_THEME_NEWFILE_FAILED']); } return array('status' => 'success', 'reload' => true, 'message' => $succesMessage, 'path' => '/' . $newFileName); } return array('status' => 'error', 'message' => sprintf($_ARRAYLANG['TXT_THEME_OPERATION_FAILED_FOR_FILE_ALREADY_EXITS'], contrexx_input2xhtml($newFileName))); }
/** * Prepare edit comment form * @global ADONewConnection * @global array langData * @param integer commentsId * @param integer newsId */ function comment_edit() { // TODO: Check and refactor if required global $objDatabase, $_ARRAYLANG; $commentID = intval($_REQUEST['commentsId']); $newsid = intval($_REQUEST['newsId']); $this->_objTpl->loadTemplateFile('module_news_comment_edit.html', true, true); $this->pageTitle = $_ARRAYLANG['TXT_NEWS_COMMENT_EDIT_TITLE']; $query = "SELECT title, text, poster_name, date, ip_address, userid FROM " . DBPREFIX . "module_news_comments WHERE id = " . $commentID; $comResult = $objDatabase->Execute($query); $strUserName = ''; if ($comResult->fields['userid'] == 0) { $strUserName = '******' . (isset($_REQUEST['cAuthor']) ? contrexx_input2xhtml($_REQUEST['cAuthor']) : contrexx_raw2xhtml($comResult->fields['poster_name'])) . '" maxlength="50" style="width:30%;" />'; } else { $objFWUser = \FWUser::getFWUserObject(); if ($objUser = $objFWUser->objUser->getUser($comResult->fields['userid'])) { $strUserName = '******' . $comResult->fields['userid'] . '" title="' . contrexx_raw2xhtml($objUser->getUsername()) . '">' . contrexx_raw2xhtml($objUser->getUsername()) . '</a>'; } else { $strUserName = $_ARRAYLANG['TXT_NEWS_COMMENT_ANONYMOUS']; } $strUserName .= '<input type="hidden" name="cAuthorID" value="' . $comResult->fields['userid'] . '"/>'; } $commenttitle = contrexx_raw2xhtml($comResult->fields['title']); $commentmessage = contrexx_raw2xhtml($comResult->fields['text']); $this->_objTpl->setVariable(array('COMMENT_TITLE' => isset($_REQUEST['cTitle']) ? contrexx_input2xhtml($_REQUEST['cTitle']) : $commenttitle, 'COMMENT_MESSAGE' => isset($_REQUEST['cMessage']) ? contrexx_input2xhtml($_REQUEST['cMessage']) : $commentmessage, 'COMMENT_AUTHOR' => $strUserName, 'COMMENT_DATE' => date(ASCMS_DATE_FORMAT, $comResult->fields['date']), 'COMMENT_IP' => $comResult->fields['ip_address'], 'NEWS_ID' => $newsid, 'TXT_NEWS_COMMENT_EDIT_TITLE' => $_ARRAYLANG['TXT_NEWS_COMMENT_EDIT_TITLE'], 'TXT_NEWS_COMMENT_EDIT_DATE' => $_ARRAYLANG['TXT_NEWS_COMMENT_DATE'], 'TXT_NEWS_COMMENT_EDIT_IP' => $_ARRAYLANG['TXT_NEWS_COMMENT_IP'], 'TXT_NEWS_COMMENT_EDIT_AUTHOR' => $_ARRAYLANG['TXT_NEWS_COMMENT_AUTHOR'], 'TXT_NEWS_COMMENT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_NEWS_COMMENT_MESSAGE' => $_ARRAYLANG['TXT_NEWS_COMMENT'], 'TXT_NEWS_COMMENT_SAVE' => $_ARRAYLANG['TXT_STORE'])); }
function _list() { global $_CORELANG, $_ARRAYLANG, $_CONFIG; $showLegacyPagealiases = isset($_GET['legacyPages']) && $_GET['legacyPages']; $this->_objTpl->loadTemplateFile('module_alias_list.html'); $this->_pageTitle = $_ARRAYLANG['TXT_ALIAS_ALIAS_ES']; $this->_objTpl->setGlobalVariable(array('TXT_ALIAS_ALIASES' => $_ARRAYLANG['TXT_ALIAS_ALIASES'], 'TXT_ALIAS_SHOW_LEGACY_PAGE_ALIASES' => $_ARRAYLANG['TXT_ALIAS_SHOW_LEGACY_PAGE_ALIASES'], 'ALIAS_SHOW_LEGACY_PAGE_ALIASES_CHECKED' => $showLegacyPagealiases ? 'checked="checked"' : '', 'ALIAS_SHOW_LEGACY_PAGE_VALUE' => intval($showLegacyPagealiases))); // show warning message if cloudrexx is running on an IIS webserver and the web.config seems not be be registred in the server configuration if (ASCMS_WEBSERVER_SOFTWARE == 'iis') { \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/PEAR/HTTP/Request2.php'); $objRequest = new \HTTP_Request2('http://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID) . '/index.php?section=Error'); try { $objResponse = $objRequest->send(); if ($objResponse->getStatus() !== 200) { $this->_objTpl->setVariable('TXT_ALIAS_IIS_HTACCESS_NOT_REGISTERED', $_ARRAYLANG['TXT_ALIAS_IIS_HTACCESS_NOT_REGISTERED']); $this->_objTpl->parse('htaccess_warning'); } else { $this->_objTpl->hideBlock('htaccess_warning'); } } catch (HTTP_Request2_Exception $objException) { \DBG::msg($objException->getMessage()); } } // Alias search was triggerd if (!empty($_GET['term'])) { $slug = '%' . $_GET['term'] . '%'; $this->_objTpl->setVariable('ALIAS_SEARCH_TERM', contrexx_input2xhtml($_GET['term'])); } else { $slug = null; } // search for aliases $this->_objTpl->setVariable(array('TXT_SEARCH' => $_CORELANG['TXT_SEARCH'])); $arrAliases = $this->_getAliases($_CONFIG['corePagingLimit'], false, $showLegacyPagealiases, $slug); if ($this->hasLegacyPages) { $this->_objTpl->touchBlock('alias_show_legacy_pages'); } else { $this->_objTpl->hideBlock('alias_show_legacy_pages'); } $nr = 1; if (count($arrAliases)) { $this->_objTpl->setVariable(array('TXT_ALIAS_PAGE' => $_ARRAYLANG['TXT_ALIAS_PAGE'], 'TXT_ALIAS_ALIAS' => $_ARRAYLANG['TXT_ALIAS_ALIAS'], 'TXT_ALIAS_FUNCTIONS' => $_ARRAYLANG['TXT_ALIAS_FUNCTIONS'], 'TXT_ALIAS_CONFIRM_DELETE_ALIAS' => $_ARRAYLANG['TXT_ALIAS_CONFIRM_DELETE_ALIAS'], 'TXT_ALIAS_OPERATION_IRREVERSIBLE' => $_ARRAYLANG['TXT_ALIAS_OPERATION_IRREVERSIBLE'])); $this->_objTpl->setGlobalVariable(array('TXT_ALIAS_DELETE' => $_ARRAYLANG['TXT_ALIAS_DELETE'], 'TXT_ALIAS_MODIFY' => $_ARRAYLANG['TXT_ALIAS_MODIFY'], 'TXT_ALIAS_OPEN_ALIAS_NEW_WINDOW' => $_ARRAYLANG['TXT_ALIAS_OPEN_ALIAS_NEW_WINDOW'])); foreach ($arrAliases as $page) { $sourceURL = $page->getSlug(); $this->_objTpl->setVariable(array('ALIAS_TARGET_ID' => $page->getNode()->getId(), 'ALIAS_SOURCE_REAL_URL' => 'http://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/' . stripslashes($sourceURL), 'ALIAS_SOURCE_URL' => 'http://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '<strong>/' . stripslashes($sourceURL) . '</strong>')); $target = ""; if ($this->_isLocalAliasTarget($page)) { // alias points to a local webpage $targetPage = $this->_fetchTarget($page); if ($targetPage) { $target = $targetPage->getTitle(); $targetURL = $this->_getURL($targetPage); $target_title = $target . " (" . $targetURL . $page->getTargetQueryString() . ")"; } } else { $target = $page->getTarget(); $targetURL = $target; $target_title = $target; } $this->_objTpl->hideBlock('alias_source_not_set'); $this->_objTpl->parse('alias_source_list'); if (\Permission::checkAccess(78, 'static', true)) { $this->_objTpl->touchBlock('alias_functions'); } else { $this->_objTpl->hideBlock('alias_functions'); } $this->_objTpl->setVariable(array('ALIAS_ROW_CLASS' => $target != $targetURL && empty($target) && $nr++ ? 'rowWarn ' : 'row' . ($nr++ % 2 + 1), 'ALIAS_TARGET_TITLE' => $target_title)); $this->_objTpl->parse('aliases_list'); } $this->_objTpl->parse('alias_data'); $this->_objTpl->hideBlock('alias_no_data'); $aliasesCount = $this->_getAliasesCount($showLegacyPagealiases, $slug); if ($aliasesCount > count($arrAliases)) { $this->_objTpl->setVariable('ALIAS_PAGING', '<br />' . getPaging($aliasesCount, !empty($_GET['pos']) ? intval($_GET['pos']) : 0, '&cmd=Alias&legacyPages=' . ($showLegacyPagealiases ? 1 : 0) . (isset($_GET['term']) ? '&term=' . $_GET['term'] : ''), $_ARRAYLANG['TXT_ALIAS_ALIASES'])); } } else { $this->_objTpl->setVariable('TXT_ALIAS_NO_ALIASES_MSG', $_ARRAYLANG['TXT_ALIAS_NO_ALIASES_MSG']); $this->_objTpl->hideBlock('alias_data'); $this->_objTpl->parse('alias_no_data'); } }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) { global $_ARRAYLANG; $userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value); $userName = \FWUser::getParsedUserTitle($userId); $crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}' \n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img \n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n width='16' height='16' \n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>"; $url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink; return $url; })), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) { $result = array(); foreach ($subscriptions as $subscription) { $productEntity = $subscription->getProductEntity(); $productEntityName = $subscription->getProduct()->getName(); if (!$productEntity) { continue; } $productEditLink = $productEntity; if (method_exists($productEntity, 'getEditLink')) { $productEditLink = $productEntity->getEditLink(); } $subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>'; $result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')'; } return implode(', ', $result); }))))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }
function addParam($name, $value) { global $strForm; $strForm .= " <tr><td>" . contrexx_input2xhtml($name) . "</td><td><input type=\"text\" name=\"" . contrexx_input2xhtml($name) . "\" value=\"" . urlencode($value) . "\" /></td></tr>\n"; }
/** * Sets placeholders for the form view. * * @param object $objTpl Template object * @param integer $formId Form id * @param integer $intView request mode frontend or backend * @param integer $arrNumSeating number of seating * * @return null */ function showForm($objTpl, $formId, $intView, $ticketSales = false) { global $_ARRAYLANG, $_LANGID; $objForm = new \Cx\Modules\Calendar\Controller\CalendarForm(intval($formId)); if (!empty($formId)) { $this->formList[$formId] = $objForm; } switch ($intView) { case 1: $this->getFrontendLanguages(); $objTpl->setGlobalVariable(array($this->moduleLangVar . '_FORM_ID' => !empty($formId) ? $objForm->id : '', $this->moduleLangVar . '_FORM_TITLE' => !empty($formId) ? $objForm->title : '')); $i = 0; $formFields = array(); if (!empty($formId)) { $defaultLangId = $_LANGID; if (!in_array($defaultLangId, \FWLanguage::getIdArray())) { $defaultLangId = \FWLanguage::getDefaultLangId(); } foreach ($objForm->inputfields as $key => $arrInputfield) { $i++; $fieldValue = array(); $defaultFieldValue = array(); foreach ($this->arrFrontendLanguages as $key => $arrLang) { $fieldValue[$arrLang['id']] = isset($arrInputfield['name'][$arrLang['id']]) ? $arrInputfield['name'][$arrLang['id']] : ''; $defaultFieldValue[$arrLang['id']] = isset($arrInputfield['default_value'][$arrLang['id']]) ? $arrInputfield['default_value'][$arrLang['id']] : ''; } $formFields[] = array('type' => $arrInputfield['type'], 'id' => $arrInputfield['id'], 'row' => $i % 2 == 0 ? 'row2' : 'row1', 'order' => $arrInputfield['order'], 'name_master' => $fieldValue[$defaultLangId], 'default_value_master' => $defaultFieldValue[$defaultLangId], 'required' => $arrInputfield['required'], 'affiliation' => $arrInputfield['affiliation'], 'field_value' => json_encode($fieldValue), 'default_field_value' => json_encode($defaultFieldValue)); } } foreach ($this->arrFrontendLanguages as $key => $arrLang) { $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang'])); $objTpl->parse('inputfieldNameList'); $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang'])); $objTpl->parse('inputfieldDefaultValueList'); $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'])); $objTpl->parse('inputfieldLanguagesList'); } foreach ($this->arrInputfieldTypes as $fieldType) { $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)])); $objTpl->parse('inputfieldTypes'); } foreach ($this->arrRegistrationFields as $fieldType) { $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)])); $objTpl->parse('inputRegfieldTypes'); } /* foreach ($this->arrInputfieldAffiliations as $strAffiliation) { $objTpl->setVariable(array( $this->moduleLangVar.'_FORM_FIELD_TYPE' => $strAffiliation, 'TXT_'.$this->moduleLangVar.'_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_AFFILIATION_'.strtoupper($strAffiliation)], )); $objTpl->parse('fieldAfflications'); }*/ $objTpl->setVariable(array($this->moduleLangVar . '_FORM_DATA' => json_encode($formFields), $this->moduleLangVar . '_FRONTEND_LANG_COUNT' => count($this->arrFrontendLanguages), $this->moduleLangVar . '_INPUTFIELD_LAST_ID' => $objForm->getLastInputfieldId(), $this->moduleLangVar . '_INPUTFIELD_LAST_ROW' => $i % 2 == 0 ? "'row2'" : "'row1'", $this->moduleLangVar . '_DISPLAY_EXPAND' => count($this->arrFrontendLanguages) > 1 ? "block" : "none")); break; case 2: $objFieldTemplate = new \Cx\Core\Html\Sigma('.'); $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true); $objFieldTemplate->setVariable(array('TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_TYPE'] . '<font class="calendarRequired"> *</font>', $this->moduleLangVar . '_FIELD_INPUT' => '<select class="calendarSelect affiliateForm" name="registrationType"><option value="1" selected="selected"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_REGISTRATION'] . '</option><option value="0"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_SIGNOFF'] . '</option></select>', $this->moduleLangVar . '_FIELD_CLASS' => 'affiliationForm')); $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_FIELD', $objFieldTemplate->get()); $objTpl->parse('calendarRegistrationField'); // $selectBillingAddressStatus = false; foreach ($objForm->inputfields as $key => $arrInputfield) { $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true); $options = array(); $options = explode(',', $arrInputfield['default_value'][$_LANGID]); $inputfield = null; $hide = false; $optionSelect = true; $availableSeat = 0; $checkSeating = false; if (isset($_POST['registrationField'][$arrInputfield['id']])) { $value = $_POST['registrationField'][$arrInputfield['id']]; } elseif (\FWUser::getFWUserObject()->objUser->login() && in_array($arrInputfield['type'], array('mail', 'firstname', 'lastname'))) { $value = ''; switch ($arrInputfield['type']) { case 'mail': $value = \FWUser::getFWUserObject()->objUser->getEmail(); break; case 'firstname': $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('firstname'); break; case 'lastname': $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('lastname'); break; default: $value = $arrInputfield['default_value'][$_LANGID]; break; } } else { $value = $arrInputfield['default_value'][$_LANGID]; } $affiliationClass = 'affiliation' . ucfirst($arrInputfield['affiliation']); switch ($arrInputfield['type']) { case 'inputtext': case 'mail': case 'firstname': case 'lastname': $inputfield = '<input type="text" class="calendarInputText" name="registrationField[' . $arrInputfield['id'] . ']" value="' . $value . '" /> '; break; case 'textarea': $inputfield = '<textarea class="calendarTextarea" name="registrationField[' . $arrInputfield['id'] . ']">' . $value . '</textarea>'; break; case 'seating': if (!$ticketSales) { $hide = true; } $optionSelect = false; if ($this->event) { $checkSeating = $this->event->registration && $this->event->numSubscriber; $availableSeat = $this->event->getFreePlaces(); } case 'select': case 'salutation': $inputfield = '<select class="calendarSelect" name="registrationField[' . $arrInputfield['id'] . ']">'; $selected = empty($_POST) ? 'selected="selected"' : ''; $inputfield .= $optionSelect ? '<option value="" ' . $selected . '>' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>' : ''; foreach ($options as $key => $name) { if ($checkSeating && contrexx_input2int($name) > $availableSeat) { continue; } $selected = $key + 1 == $value ? 'selected="selected"' : ''; $inputfield .= '<option value="' . intval($key + 1) . '" ' . $selected . '>' . $name . '</option>'; } $inputfield .= '</select>'; break; case 'radio': foreach ($options as $key => $name) { $checked = $key + 1 == $value || empty($_POST) && $key == 0 ? 'checked="checked"' : ''; $textValue = isset($_POST["registrationFieldAdditional"][$arrInputfield['id']][$key]) ? $_POST["registrationFieldAdditional"][$arrInputfield['id']][$key] : ''; $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . contrexx_input2xhtml($textValue) . '" />'; $name = str_replace('[[INPUT]]', $textfield, $name); $inputfield .= '<input type="radio" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . ']" value="' . intval($key + 1) . '" ' . $checked . '/> ' . $name . '<br />'; } break; case 'checkbox': foreach ($options as $key => $name) { $textValue = isset($_POST["registrationFieldAdditional"][$arrInputfield['id']][$key]) ? $_POST["registrationFieldAdditional"][$arrInputfield['id']][$key] : ''; $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . contrexx_input2xhtml($textValue) . '" />'; $name = str_replace('[[INPUT]]', $textfield, $name); $checked = in_array($key + 1, $_POST['registrationField'][$arrInputfield['id']]) ? 'checked="checked"' : ''; $inputfield .= '<input ' . $checked . ' type="checkbox" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="' . intval($key + 1) . '" /> ' . $name . '<br />'; } break; case 'agb': $inputfield = '<input class="calendarInputCheckbox" type="checkbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="1" /> ' . $_ARRAYLANG['TXT_CALENDAR_AGB'] . '<br />'; break; /* case 'selectBillingAddress': if(!$selectBillingAddressStatus) { if($_REQUEST['registrationField'][$arrInputfield['id']] == 'deviatesFromContact') { $selectDeviatesFromContact = 'selected="selected"'; } else { $selectDeviatesFromContact = ''; } $inputfield = '<select id="calendarSelectBillingAddress" class="calendarSelect" name="registrationField['.$arrInputfield['id'].']">'; $inputfield .= '<option value="sameAsContact">'.$_ARRAYLANG['TXT_CALENDAR_SAME_AS_CONTACT'].'</option>'; $inputfield .= '<option value="deviatesFromContact" '.$selectDeviatesFromContact.'>'.$_ARRAYLANG['TXT_CALENDAR_DEVIATES_FROM_CONTACT'].'</option>'; $inputfield .= '</select>'; $selectBillingAddressStatus = true; } break; */ /* case 'selectBillingAddress': if(!$selectBillingAddressStatus) { if($_REQUEST['registrationField'][$arrInputfield['id']] == 'deviatesFromContact') { $selectDeviatesFromContact = 'selected="selected"'; } else { $selectDeviatesFromContact = ''; } $inputfield = '<select id="calendarSelectBillingAddress" class="calendarSelect" name="registrationField['.$arrInputfield['id'].']">'; $inputfield .= '<option value="sameAsContact">'.$_ARRAYLANG['TXT_CALENDAR_SAME_AS_CONTACT'].'</option>'; $inputfield .= '<option value="deviatesFromContact" '.$selectDeviatesFromContact.'>'.$_ARRAYLANG['TXT_CALENDAR_DEVIATES_FROM_CONTACT'].'</option>'; $inputfield .= '</select>'; $selectBillingAddressStatus = true; } break; */ case 'fieldset': $inputfield = null; break; } $field = ''; if ($arrInputfield['type'] == 'fieldset') { $field = '</fieldset><fieldset><legend>' . $arrInputfield['name'][$_LANGID] . '</legend>'; $hide = true; } else { $required = $arrInputfield['required'] == 1 ? '<font class="calendarRequired"> *</font>' : ''; $label = $arrInputfield['name'][$_LANGID] . $required; } if (!$hide) { $objFieldTemplate->setVariable(array('TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $label, $this->moduleLangVar . '_FIELD_INPUT' => $inputfield, $this->moduleLangVar . '_FIELD_CLASS' => $affiliationClass)); $field = $objFieldTemplate->get(); } $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_FIELD', $field); $objTpl->parse('calendarRegistrationField'); } break; } }
/** * set the placeholders for the category view * * @return null */ function showCategoryView() { global $_ARRAYLANG, $_CORELANG; $this->_objTpl->setTemplate($this->pageContent, true, true); $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true); $objCategoryManager->getCategoryList(); $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_SEARCH_TERM' => $_ARRAYLANG['TXT_CALENDAR_KEYWORD'], 'TXT_' . $this->moduleLangVar . '_FROM' => $_ARRAYLANG['TXT_CALENDAR_FROM'], 'TXT_' . $this->moduleLangVar . '_TILL' => $_ARRAYLANG['TXT_CALENDAR_TILL'], 'TXT_' . $this->moduleLangVar . '_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_SEARCH' => $_ARRAYLANG['TXT_CALENDAR_SEARCH'], 'TXT_' . $this->moduleLangVar . '_OCLOCK' => $_ARRAYLANG['TXT_CALENDAR_OCLOCK'], $this->moduleLangVar . '_SEARCH_TERM' => isset($_GET['term']) ? contrexx_input2xhtml($_GET['term']) : '', $this->moduleLangVar . '_SEARCH_FROM' => isset($_GET['from']) ? contrexx_input2xhtml($_GET['from']) : '', $this->moduleLangVar . '_SEARCH_TILL' => isset($_GET['till']) ? contrexx_input2xhtml($_GET['till']) : '', $this->moduleLangVar . '_SEARCH_CATEGORIES' => $objCategoryManager->getCategoryDropdown(isset($_GET['catid']) ? intval($_GET['catid']) : 0, 1))); if (isset($this->categoryId)) { $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory($this->categoryId); $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name)); $this->objEventManager->showEventList($this->_objTpl); $this->_objTpl->parse('categoryList'); } else { foreach ($objCategoryManager->categoryList as $key => $objCategory) { $objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $objCategory->id, $this->searchTerm, true, $this->needAuth, true, $this->startPos, $this->numEvents); $objEventManager->getEventList(); $objEventManager->showEventList($this->_objTpl); $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name)); $this->_objTpl->parse('categoryList'); } } }
/** * Overview of opportunity * * @global array $_ARRAYLANG * @global object $objDatabase * @return true */ function dealsOverview() { global $objDatabase, $_ARRAYLANG; \JS::activate("jquery"); $tpl = isset($_GET['tpl']) ? $_GET['tpl'] : ''; switch ($tpl) { case 'manage': $this->_modifyDeal(); return; break; default: break; } $settings = $this->getSettings(); $allowPm = $this->isPmInstalled && $settings['allow_pm']; $objTpl = $this->_objTpl; $objTpl->loadTemplateFile("module_{$this->moduleNameLC}_deals_overview.html"); $this->_pageTitle = $_ARRAYLANG['TXT_CRM_OPPORTUNITY']; $objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName, 'PM_MODULE_NAME' => $this->pm_moduleName)); $action = isset($_REQUEST['actionType']) ? $_REQUEST['actionType'] : ''; $dealsEntries = isset($_REQUEST['dealsEntry']) ? array_map('intval', $_REQUEST['dealsEntry']) : 0; switch ($action) { case 'delete': $this->deleteDeals($dealsEntries, $allowPm); break; case 'deletedeals': $this->deleteDeal($allowPm); if (isset($_GET['ajax'])) { exit; } break; default: break; } $mes = isset($_REQUEST['mes']) ? base64_decode($_REQUEST['mes']) : ''; if (!empty($mes)) { switch ($mes) { case "dealsAdded": $this->_strOkMessage = $_ARRAYLANG['TXT_CRM_DEALS_ADDED_SUCCESSFULLY']; break; case "dealsUpdated": $this->_strOkMessage = $_ARRAYLANG['TXT_CRM_DEALS_UPDATED_SUCCESSFULLY']; break; case "dealsdeleted": $this->_strOkMessage = $_ARRAYLANG['TXT_CRM_DEALS_DELETED_SUCCESSFULLY']; break; } } $searchLink = ''; $where = array(); if (isset($_GET['term']) && !empty($_GET['term'])) { $where[] = " d.title LIKE '%" . contrexx_input2raw($_GET['term']) . "%' OR c.customer_name LIKE '%" . contrexx_input2raw($_GET['term']) . "%'"; $searchLink = "&term={$_GET['term']}"; } // Join where conditions $filter = ''; if (!empty($where)) { $filter = " WHERE " . implode(' AND ', $where); } $sortingFields = array("d.id", "d.title", "d.quoted_price", "c.customer_name", "u.username", "d.due_date"); $sorto = isset($_GET['sorto']) ? (int) $_GET['sorto'] == 0 ? 'DESC' : 'ASC' : 'DESC'; $sortf = isset($_GET['sortf']) && in_array($sortingFields[$_GET['sortf']], $sortingFields) ? $sortingFields[$_GET['sortf']] : $sortingFields[0]; $sortLink = "&sorto={$_GET['sorto']}&sortf={$_GET['sortf']}"; $query = "SELECT\n d.id,\n d.title,\n d.quoted_price,\n d.customer,\n c.customer_name,\n c.contact_familyname,\n d.quote_number,\n d.assigned_to,\n d.due_date,\n stages.stage AS percent\n FROM " . DBPREFIX . "module_{$this->moduleNameLC}_deals AS d\n LEFT JOIN " . DBPREFIX . "module_{$this->moduleNameLC}_contacts AS c\n ON d.customer = c.id\n LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_contact_websites` AS web\n ON d.website = web.id\n {$filter}\n LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_stages` AS stages\n ON d.stage = stages.id\n ORDER BY {$sortf} {$sorto}"; $objResult = $objDatabase->Execute($query); /* Start Paging ------------------------------------ */ $intPos = isset($_GET['pos']) ? intval($_GET['pos']) : 0; $intPerPage = $this->getPagingLimit(); //$intPerPage = 5; //For Testing $this->_objTpl->setVariable('ENTRIES_PAGING', getPaging($this->countRecordEntries($query), $intPos, "./index.php?cmd=" . $this->moduleName . "&act=deals{$searchLink}{$sortLink}", false, true, $intPerPage)); $pageLink = "&pos={$intPos}"; /* End Paging -------------------------------------- */ $selectLimit = " LIMIT {$intPos}, {$intPerPage}"; $query = $query . $selectLimit; $objResult = $objDatabase->Execute($query); if ($objResult) { if ($objResult->RecordCount() <= 0) { $objTpl->touchBlock("dealsNoRecords"); } else { $objTpl->hideBlock("dealsNoRecords"); } $row = "row2"; while (!$objResult->EOF) { $objTpl->setVariable(array('ENTRY_ID' => (int) $objResult->fields['id'], 'CRM_DEALS_TITLE' => contrexx_raw2xhtml($objResult->fields['title']), 'CRM_DEALS_PERCENTAGE' => $objResult->fields['percent'], 'CRM_CONTACT_NAME' => "<a href='./index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$objResult->fields['customer']}' title='details'>" . contrexx_raw2xhtml($objResult->fields['customer_name'] . " " . $objResult->fields['contact_familyname']) . '</a>', 'CRM_DEALS_CONTACT_NAME' => contrexx_raw2xhtml($this->getUserName($objResult->fields['assigned_to'])), 'CRM_DEALS_DUE_DATE' => contrexx_raw2xhtml($objResult->fields['due_date']), 'CRM_DEALS_QUOTED_PRICE' => contrexx_raw2xhtml($objResult->fields['quoted_price']), 'ROW_CLASS' => $row = $row == "row2" ? "row1" : 'row2', 'CRM_REDIRECT_LINK' => '&redirect=' . base64_encode("&act=deals{$searchLink}{$sortLink}{$pageLink}"), 'TXT_CRM_IMAGE_EDIT' => $_ARRAYLANG['TXT_EDIT'], 'TXT_CRM_IMAGE_DELETE' => $_ARRAYLANG['TXT_DELETE'])); $objTpl->parse("dealsEntries"); $objResult->MoveNext(); } } $sortOrder = $_GET['sorto'] == 0 ? 1 : 0; $objTpl->setVariable(array('CRM_NAME_SORT' => "&sortf=1&sorto={$sortOrder}", 'CRM_PRICE_SORT' => "&sortf=2&sorto={$sortOrder}", 'CRM_CUSTOMER_SORT' => "&sortf=3&sorto={$sortOrder}", 'CRM_RESPONSIBLE_SORT' => "&sortf=4&sorto={$sortOrder}", 'CRM_DUE_DATE_SORT' => "&sortf=5&sorto={$sortOrder}", 'CRM_SEARCH_LINK' => $searchLink, 'TXT_CRM_SEARCH' => $_ARRAYLANG['TXT_CRM_SEARCH'], 'TXT_CRM_DEALS_CREATE' => $_ARRAYLANG['TXT_CRM_DEALS_CREATE'], 'TXT_CRM_DEALS_QUOTED_PRICE' => $_ARRAYLANG['TXT_CRM_PROJECT_QUOTED_PRICE'], 'TXT_CRM_DEALS_OVERVIEW' => $_ARRAYLANG['TXT_CRM_DEALS_OVERVIEW'], 'TXT_CRM_DEALS_PERCENTAGE' => $_ARRAYLANG['TXT_CRM_DEALS_PERCENTAGE'], 'TXT_CRM_DEALS_TITLE' => $_ARRAYLANG['TXT_CRM_DEALS_TITLE'], 'TXT_CRM_DEALS_CUSTOMER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_NAME'], 'TXT_CRM_FUNCTIONS' => $_ARRAYLANG['TXT_CRM_FUNCTIONS'], 'TXT_CRM_DEALS_CONTACT_PERSON' => $_ARRAYLANG['TXT_CRM_CONTACT_PERSON'], 'TXT_CRM_DEALS_DUE_DATE' => $_ARRAYLANG['TXT_CRM_DUE_DATE'], 'TXT_CRM_SELECT_ACTION' => $_ARRAYLANG['TXT_CRM_SELECT_ACTION'], 'TXT_CRM_DELETE_SELECTED' => $_ARRAYLANG['TXT_CRM_DELETE_SELECTED'], 'TXT_CRM_SELECT_ALL' => $_ARRAYLANG['TXT_CRM_SELECT_ALL'], 'TXT_CRM_REMOVE_SELECTION' => $_ARRAYLANG['TXT_CRM_REMOVE_SELECTION'], 'TXT_NO_RECORDS_FOUND' => $_ARRAYLANG['TXT_CRM_NO_RECORDS_FOUND'], 'TXT_SELECT_ENTRIES' => $_ARRAYLANG['TXT_CRM_NO_OPERATION'], 'TXT_CRM_FILTERS' => $_ARRAYLANG['TXT_CRM_FILTERS'], 'TXT_CRM_DEALS_RESPONSIBLE' => $_ARRAYLANG['TXT_CRM_PROJECT_RESPONSIBLE'], 'CRM_DEALS_SEARCH_TERM' => contrexx_input2xhtml($_GET['term']), 'TXT_CRM_ENTER_SEARCH_TERM' => $_ARRAYLANG['TXT_CRM_ENTER_SEARCH_TERM'], 'TXT_CRM_CONFIRM_DELETE_ENTRY' => $_ARRAYLANG['TXT_CRM_ARE_YOU_SURE_DELETE_ENTRIES'], 'TXT_CRM_ENTRY_DELETED_SUCCESS' => $_ARRAYLANG['TXT_CRM_ENTRY_DELETED_SUCCESS'])); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $orders = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($orders); // setDataType is used to make the ViewGenerator load the proper options if $orders is empty $orders->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Order'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, $options); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }