/** * Deletes tax rate by zip set. */ function onAction() { global $application; $SessionPost = array(); $SessionPost = $_POST; $Errors = array(); $Result = array(); $request = new Request(); $request->setView("PopupWindow"); $updateSid = $request->getValueByKey("updateSid", 0); if ($updateSid) { $request->setKey("updateSid", $updateSid); } $description = ''; if (isset($_POST['file_description'])) { $description = prepareHTMLDisplay(trim($_POST['file_description'])); } if ($description == '') { $SessionPost['Errors'][] = getMsg("TAX_ZIP", "ADD_NEW_SET_EMPTY_FILE_DESCRIPTION_ERROR"); modApiFunc('Session', 'set', 'SessionPost', $SessionPost); $request->setKey("page_view", "TaxRateByZip_AddNewSet"); $application->redirect($request); return; } modApiFunc('Session', 'set', 'SessionPost', $SessionPost); $sid = modApiFunc("TaxRateByZip", "addSetToDB", $description, $_POST["csv_file_name"]); $request->setKey("page_view", "TaxRatesImportView"); $request->setKey("sid", $sid); $application->redirect($request); }
function outputShippingModulesList() { global $application; $retval = ""; $sm_list = modApiFunc("Taxes", "getShippingModulesList"); $n = sizeof($sm_list); if ($n == 0) { $retval .= modApiFunc('TmplFiller', 'fill', "taxes/prod-tax-sm-list/", "item_na.tpl.html", array()); for ($i = 0; $i < 9; $i++) { $retval .= modApiFunc('TmplFiller', 'fill', "taxes/prod-tax-sm-list/", "item_empty.tpl.html", array()); } } else { $i = 0; foreach ($sm_list as $sm_id => $sm_info) { $this->_Template_Contents = array('Name' => prepareHTMLDisplay($sm_info["Name"]), 'I' => $i, 'Id' => $sm_id, 'Checked' => $sm_info["Checked"] ? "CHECKED" : ""); $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "taxes/prod-tax-sm-list/", "item.tpl.html", array()); $i++; } if ($n < 10) { for ($i = 0; $i < 10 - $n; $i++) { $retval .= modApiFunc('TmplFiller', 'fill', "taxes/prod-tax-sm-list/", "item_empty.tpl.html", array()); } } } return $retval; }
/** * * * @ * @param * @return */ function outputAdminList() { global $application; $retval = ""; $admin_members = modApiFunc("Users", "getAdminMembersList"); $i = 0; //$min_list_size = 10; foreach ($admin_members as $member) { $current_admin = modApiFunc("Users", "getCurrentUserID") == $member["id"] ? true : false; $request = new Request(); $request->setView('AdminMemberInfo'); $request->setAction('SetSelectedUser'); $request->setKey('uid', $member["id"]); $request->setKey('edit', true); $link = $request->getURL(); $template_contents = array("AdminMemberInfoLink" => $link, "AdminId" => $member["id"], "Style" => "visible", "AdminCheckBox" => $current_admin ? "" : "select_" . $i, "AdminCheckBoxName" => $current_admin ? "" : "selected_admins[" . ($i + 1) . "]", "AdminName" => prepareHTMLDisplay($member["firstname"] . " " . $member["lastname"]), "CurrentAdmin" => $current_admin ? "<span class=\"font-red\">*</span>" : "", "Email" => $member["email"], "LogNum" => $member["lognum"], "LoggedIn" => $member["logdate"] && $member["logdate"] != "0000-00-00" ? modApiFunc("Localization", "SQL_date_format", $member["logdate"]) : $this->MessageResources->getMessage("ADMIN_MEMBERS_LABEL_001"), "Created" => modApiFunc("Localization", "SQL_date_format", $member["created"]), "Modified" => $member["modified"] && $member["modified"] != "0000-00-00" ? modApiFunc("Localization", "SQL_date_format", $member["modified"]) : $this->MessageResources->getMessage("ADMIN_MEMBERS_LABEL_002"), "Enabled" => $current_admin ? " DISABLED" : ""); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "users/admin_members/", "item.tpl.html", array()); if (!$current_admin) { $i++; } } for (; $i < $min_list_size; $i++) { $retval .= modApiFunc('TmplFiller', 'fill', "users/admin_members/", "item_empty.tpl.html", array()); } return $retval; }
function initFormData() { $this->ViewState = array("hasCloseScript" => "false", "TaxRateAction" => ""); $TaxInfo = modApiFunc("Taxes", "getTaxRateInfo", modApiFunc("Taxes", "getEditableTaxId", "TaxRate")); $replace = array(); $TaxNamesList = modApiFunc("Taxes", "getTaxNamesList"); foreach ($TaxNamesList as $taxNameInfo) { $replace['{t_' . $taxNameInfo['Id'] . '}'] = prepareHTMLDisplay($taxNameInfo['Name']); } $costList = modApiFunc("Taxes", "getTaxCostsList"); foreach ($costList as $cost) { $replace['{p_' . $cost['id'] . '}'] = $this->MessageResources->getMessage($cost['name']); } preg_match_all("/([0-9]+\\.?[0-9]+)/", $TaxInfo['Formula'], $numbers); for ($j = 0; $j < sizeof($numbers[0]); $j++) { $replace[$numbers[0][$j]] = modApiFunc("Localization", "num_format", $numbers[0][$j]); } if (!$TaxInfo['Id']) { $TaxInfo['CountryId'] = modApiFunc("Taxes", "getCountryId"); $TaxInfo['StateId'] = "0"; $this->ViewState["TaxRateAction"] = "AddTaxRateAction"; } else { $this->ViewState["TaxRateAction"] = "UpdateTaxRateAction"; } $ProductTaxClassId = modApiFunc("Taxes", "getTaxClassId"); $ProductTaxClassName = modApiFunc("Taxes", "getTaxClassInfo", $ProductTaxClassId); $ProductTaxClassName = $ProductTaxClassName["name"]; $this->POST = array("Id" => $TaxInfo['Id'], "CountryId" => $TaxInfo['CountryId'], "StateId" => $TaxInfo['StateId'], "ProductTaxClassId" => $ProductTaxClassId, "ProductTaxClassName" => $ProductTaxClassName, "TaxNameId" => $TaxInfo['TaxNameId'], "Rate" => $TaxInfo['rates_set'] == 0 ? modApiFunc("Localization", "num_format", $TaxInfo['Rate']) : 0, "FormulaView" => $TaxInfo['Formula'] ? strtr($TaxInfo['Formula'], $replace) : " ", "Formula" => $TaxInfo['Formula'], "Applicable" => $TaxInfo['Applicable'], "TaxRateByZipSet" => $TaxInfo['rates_set']); }
function outputMessagesList() { global $application; $messages = modApiFunc('Newsletter', 'getMessagesList'); $this->getTopicsNames($messages); $templateContents = array('LetterCreationDate' => '', 'LetterSentDate' => '', 'LetterFrom' => '', 'LetterSubject' => '', 'LetterNum' => '', 'LetterId' => '', 'LetterTopics' => ''); $application->registerAttributes($templateContents); $result = ''; $counter = 0; foreach ($messages as $msg) { $counter++; $creation_date = modApiFunc('Localization', 'date_format', $msg['letter_creation_date']) . " " . modApiFunc('Localization', 'SQL_time_format', $msg['letter_creation_date']); $sent_date = $msg['letter_sent_date'] == null ? $this->_messageResources->getMessage('LETTER_NOT_SENT') : modApiFunc('Localization', 'date_format', $msg['letter_sent_date']) . " " . modApiFunc('Localization', 'SQL_time_format', $msg['letter_sent_date']); $this->_listTemplateContents = array('LetterCreationDate' => $creation_date, 'LetterSentDate' => $sent_date, 'LetterFrom' => prepareHTMLDisplay($msg['letter_from_name']) . ' <' . prepareHTMLDisplay($msg['letter_from_email']) . '>', 'LetterSubject' => prepareHTMLDisplay($msg['letter_subject']), 'LetterNum' => $counter, 'LetterId' => $msg['letter_id'], 'LetterTopics' => $msg['topics_names']); $result .= $this->_tmplFiller->fill('newsletter/', 'item.tpl.html', array()); } if ($counter == 0) { $result .= $this->_tmplFiller->fill('newsletter/', 'item_no_items.tpl.html', array()); $counter++; } for ($i = 0; $i < 10 - $counter; $i++) { $result .= $this->_tmplFiller->fill('newsletter/', 'item_empty.tpl.html', array()); } return $result; }
/** * @ describe the function UpdateCustomAttribute->. */ function onAction() { $EditCustomAttributeForm = array(); $EditCustomAttributeForm = $_POST; $EditCustomAttributeForm["ErrorsArray"] = array(); // check "Attribute Name" if (isEmptyKey('name', $EditCustomAttributeForm)) { // a required attribute $EditCustomAttributeForm["ErrorsArray"]["name"] = new ActionMessage("ADDCUSTOM_003"); } // check "Attribute Description" if (isEmptyKey('descr', $EditCustomAttributeForm)) { // a required attribute $EditCustomAttributeForm["ErrorsArray"]["descr"] = new ActionMessage("ADDCUSTOM_004"); } if (empty($EditCustomAttributeForm["ErrorsArray"])) { $EditCustomAttributeForm['input_type_values'] = isset($EditCustomAttributeForm['input_type_values']) ? $EditCustomAttributeForm['input_type_values'] : array(); if (!empty($EditCustomAttributeForm['input_type_values'])) { foreach ($EditCustomAttributeForm['input_type_values'] as $key => $item) { if (empty($item)) { unset($EditCustomAttributeForm['input_type_values'][$key]); } } } $custom_attributes = modApiFunc('Catalog', 'getTempCustomAttributes', $EditCustomAttributeForm['form_id']); $orig_attr = $custom_attributes[$EditCustomAttributeForm['view_tag']]; $attr = array('id' => $orig_attr['id'], 'pta_id' => $orig_attr['pta_id'], 'name' => prepareHTMLDisplay($EditCustomAttributeForm['name']), 'descr' => prepareHTMLDisplay($EditCustomAttributeForm['descr']), 'size' => $orig_attr['size'], 'min' => $orig_attr['min'], 'max' => $orig_attr['max'], 'view_tag' => $orig_attr['view_tag'], 'group' => $orig_attr['group'], 'required' => $orig_attr['required'], 'visible' => $orig_attr['visible'], 'default' => $orig_attr['default'], 'sort' => $orig_attr['sort'], 'type' => $orig_attr['type'], 'patt' => $orig_attr['patt'], 'patt_type' => $orig_attr['patt_type'], 'input_type_id' => $orig_attr['input_type_id'], 'input_type_name' => $orig_attr['input_type_name'], 'unit_type_value' => $orig_attr['unit_type_value'], 'vanishing' => $orig_attr['vanishing'], 'input_type_values' => $EditCustomAttributeForm['input_type_values']); modApiFunc('Catalog', 'updateTempCustomAttribute', $EditCustomAttributeForm['form_id'], $attr); $EditCustomAttributeForm["close"] = true; } modApiFunc('Session', 'set', 'EditCustomAttributeForm', $EditCustomAttributeForm); }
/** * Processes tags in the templates for the given view. * * @return string tag value, if tag has been processed. NULL, otherwise. */ function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Local_SearchFormAction': $_request = new Request(); $_request->setView('SearchResult'); $value = $_request->getURL(); break; case 'Local_SearchFormName': $value = 'CatalogSearchForm'; break; case 'Local_ActionName': $value = 'asc_action'; break; case 'Local_ActionValue': $value = 'SearchProducts'; break; case 'Local_SearchTextFieldName': $value = 'search_pattern'; break; case 'Local_SearchText': if (modApiFunc('Session', 'is_Set', 'search_result_id')) { $search_id = modApiFunc('Session', 'get', 'search_result_id'); $value = modApiFunc('CatalogSearch', 'getSearchPatternInSearchResult', $search_id); $value = prepareHTMLDisplay($value); } else { $value = ''; } break; } return $value; }
/** * The main function to output the viewer */ function output() { global $application; // getting page id // if not specified then a new page is being added $page_id = modApiFunc('Request', 'getValueByKey', 'page_id'); if (!$page_id) { $page_id = 0; } $this->_Page_Data = modApiFunc('CMS', 'searchPages', array('page_id' => $page_id)); // getting page data if (!empty($this->_Page_Data)) { // the page_id is specified and valid $this->_Page_Data = array_pop($this->_Page_Data); } else { // the page_id is eihter not specified or not valid // assuming adding a new page $this->_Page_Data = array('page_id' => 0, 'availability' => 'C', 'status' => 'A', 'parent_id' => 0); } // restoring data from session if any // use case: restoring submitted form with an error if (modApiFunc('Session', 'is_set', 'SavedPageData')) { $this->_Page_Data = modApiFunc('Session', 'get', 'SavedPageData'); modApiFunc('Session', 'un_set', 'SavedPageData'); } $template_contents = array('PageJSCode' => $this->outputJSCode(), 'PageID' => $this->_Page_Data['page_id'], 'PageIndex' => prepareHTMLDisplay(@$this->_Page_Data['page_index']), 'PageName' => prepareHTMLDisplay(@$this->_Page_Data['name']), 'ParentSelectBox' => $this->outputParentSelectBox(), 'PageContent' => prepareHTMLDisplay(@$this->_Page_Data['descr']), 'PageStatus' => @$this->_Page_Data['status'], 'PageSEOPrefix' => prepareHTMLDisplay(@$this->_Page_Data['seo_prefix']), 'PageSEOTitle' => prepareHTMLDisplay(@$this->_Page_Data['seo_title']), 'PageMETADescription' => prepareHTMLDisplay(@$this->_Page_Data['seo_descr']), 'PageMETAKeywords' => prepareHTMLDisplay(@$this->_Page_Data['seo_keywords']), 'PageAvailability' => @$this->_Page_Data['availability'], 'ResultMessage' => $this->outputResultMessage(), 'EditPageTitle' => @$this->_Page_Data['page_id'] > 0 ? getMsg('CMS', 'CMS_EDIT_PAGE') : getMsg('CMS', 'CMS_ADD_PAGE')); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return $this->mTmplFiller->fill('cms/cms_page_data/', 'container.tpl.html', array()); }
function output() { global $application; $template_contents = array('OverFlowText' => $this->outputOverFlowText(), 'PatternValue' => prepareHTMLDisplay($this->getPatternValue()), 'isFormActive' => empty($this->Filter) ? 'N' : 'Y'); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return $this->mTmplFiller->fill($this->_template_dir, 'container.tpl.html', array()); }
/** * */ function initFromDB($id_letter) { $letter_info = modApiFunc('Newsletter', 'getMessageInfo', $id_letter); if (empty($letter_info)) { return; } foreach ($letter_info as $key => $val) { $this->_post[$key] = prepareHTMLDisplay($val); } $this->_post["letter_id"] = $id_letter; $this->_viewState = array('hasCloseScript' => 'false', 'FormSubmitValue' => 'save'); $this->_post['topic'] = modApiFunc('Subscriptions', 'getLetterTopics', $id_letter); }
function copyFormData() { $this->form = modApiFunc("Session", "get", "EditCustomAttributeForm"); if (isset($this->form["ErrorsArray"]) && count($this->form["ErrorsArray"]) > 0) { $this->errors = $this->form["ErrorsArray"]; unset($this->form["ErrorsArray"]); } $this->form['view_tag'] = prepareHTMLDisplay($this->form['view_tag']); $this->form['name'] = prepareHTMLDisplay($this->form['name']); $this->form['descr'] = prepareHTMLDisplay($this->form['descr']); if (isset($this->form['default'])) { $this->form['default'] = prepareHTMLDisplay($this->form['default']); } }
function outFilesByOne() { global $application; $html_code = ''; foreach ($this->PFiles as $k => $pf_info) { $r = new Request(); $r->setAction('direct_download_file'); $r->setKey('file_id', $pf_info['file_id']); $template_contents = array('CycleColor' => $k % 2 == 0 ? '#FFFFFF' : '#EEF2F8', 'FileID' => $pf_info['file_id'], 'FileName' => $pf_info['file_name'], 'FSize' => modApiFunc('Product_Files', 'formatFileSize', $pf_info['file_size']), 'FileDescr' => prepareHTMLDisplay($pf_info['file_descr']), 'DirectFileLink' => $r->getURL()); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); $html_code .= $this->mTmplFiller->fill("product_files/files_list/", "one-file.tpl.html", array()); } return $html_code; }
/** * */ function output() { global $application; $request =& $application->getInstance('Request'); $templateFiller = $application->getInstance('TmplFiller'); $letter_id = $request->getValueByKey('letter_id'); $letter_info = modApiFunc('Newsletter', 'getMessageInfo', $letter_id); if (empty($letter_info)) { $vars = array('Title' => getMsg('NLT', 'DELIVERY_TITLE')); return $templateFiller->fill('newsletter/', 'error_no_newsletter.tpl.html', $vars); } $counts = modApiFunc('Subscriptions', 'getLettersEmailsCount', array($letter_id)); $letter_topics = $this->getLetterTopics($letter_id); $templateContents = array('LetterId' => $letter_id, 'LetterFrom' => prepareHTMLDisplay($letter_info['letter_from_name']) . ' <' . prepareHTMLDisplay($letter_info['letter_from_email']) . ' >', 'LetterSubject' => prepareHTMLDisplay($letter_info['letter_subject']), 'LetterTopics' => $letter_topics, 'EnableSend' => @$counts[$letter_id] > 0 ? 'yes' : '', 'TotalRecipients' => (int) @$counts[$letter_id]); $application->registerAttributes($templateContents); $this->_templateContents = $templateContents; return $templateFiller->fill('newsletter/', 'delivery_progress.tpl.html', array()); }
function outputLocationBreadcrumb($parents_list, $links, $view_name = "NavigationBar") { global $application; $CategoryId1Info = new CCategoryInfo(1); $this->CategoryId1Name = $CategoryId1Info->getCategoryTagValue('name'); $retval = ""; $isFirst = 1; $n = sizeof($parents_list); for ($i = 0; $i < $n; $i++) { $value = $parents_list[$i]; $cat = new CCategoryInfo($value["id"]); $name = prepareHTMLDisplay($value["name"]); if ($cat->getCategoryTagValue('RecursiveStatus') == CATEGORY_STATUS_ONLINE) { } else { $name = '<span style="color: rgb(175, 175, 175);">' . $name . '</span>'; } $arr = array("Href" => $this->getLinkToView($value["id"], $view_name, $cat), "Name" => $name, "CategoryId1Name" => prepareHTMLDisplay($this->CategoryId1Name)); if ($n == 1) { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "single.tpl.html", $arr); } else { if ($i == 0) { if ($links) { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "first_link.tpl.html", $arr); } else { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "first.tpl.html", $arr); } } else { if ($i == $n - 1) { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "last.tpl.html", $arr); } else { if ($links) { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "default_link.tpl.html", $arr); } else { $retval .= $this->mTmplFiller->fill("catalog/breadcrumb/", "default.tpl.html", $arr); } } } } } if ($retval == "") { CTrace::wrn(array("CODE" => "CORE_053"), __CLASS__, __FUNCTION__); } return $retval; }
function output() { global $application; $parameters = func_get_args(); $this->asc_ctor($parameters[1]); if (!$this->image_obj->is_empty()) { //: Images :: getImageData($image_id) $image_data = modApiFunc("Images", "selectImageThumbnail", $this->image_obj->get_id(), IMAGE_THUMB_SIZE); if ($image_data === NULL) { $this->_Template_Contents = array("IOId" => $parameters[0], "IOSrc" => modApiFunc("Images", "getAZImageSRC", EMPTY_IMAGE_BASENAME), "IOAltText" => getMsg('IMG', 'EMPTY_IMAGE_ALT_TEXT')); } else { $this->_Template_Contents = array("IOId" => $parameters[0], "IOSrc" => modApiFunc("Images", "getImageSRC", $image_data), "IOAltText" => prepareHTMLDisplay($image_data['image_alt_text'])); } } $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/'); $res = $this->mTmplFiller->fill("image_output/", "container.tpl.html", array()); return $res; }
/** * */ function onAction() { global $application; $MessageResources =& $application->getInstance('MessageResources'); $request = $application->getInstance('Request'); $comment = $request->getValueByKey('comment'); $comment_hash = $request->getValueByKey('comment_hash'); if ($comment_hash != md5($comment) && $comment) { $filename = modApiFunc("Tools", "getCurrentBackupFile"); $backup_dir = $application->getAppIni('PATH_BACKUP_DIR'); $time = time(); $admin_info = modApiFunc("Users", "getUserInfo", modApiFunc("Users", "getCurrentUserID")); $fp = fopen($backup_dir . $filename . "/info/backup.log", "a"); $msg = 'BCP_INFO_LOG_MSG_002'; fwrite($fp, $MessageResources->getMessage(new ActionMessage(array($msg, modApiFunc("Localization", "timestamp_date_format", $time), modApiFunc("Localization", "timestamp_time_format", $time), $admin_info['firstname'], $admin_info['lastname'], $admin_info['email'])))); fwrite($fp, "<i>" . strtr(prepareHTMLDisplay($comment), array("\n" => "<br>")) . "</i><br><hr style='border: 0px; height: 1px; color: #b2c2df; background-color: #b2c2df;'><br>"); fclose($fp); modApiFunc('Session', 'set', 'ResultMessage', 'BCP_INFO_SAVED'); } }
function getTag($tag) { $value = null; switch ($tag) { case 'Local_FormActionURL': $r = new Request(); $r->setAction('save_personal_info'); $r->setView('CustomerPersonalInfo'); $value = $r->getURL(); break; case 'Local_PersonalInfo': $value = $this->out_PersonalInfoGroups(); break; case 'Local_FormName': $group_info = $this->customer_obj->getPersonInfoGroupInfoByName($this->current_group_name); $value = getMsg('CA', $group_info['lang_code']); break; case 'Local_Form': $value = $this->out_GroupAttributes(); break; case 'Local_FieldName': $attr_info = $this->customer_obj->getPersonInfoAttrInfoByName($this->current_attr_name, $this->current_group_name); $value = prepareHTMLDisplay($attr_info['visible_name']); break; case 'Local_Field': $attr_value = $this->customer_obj->getPersonInfo($this->current_attr_name, $this->current_group_name); switch (_ml_strtolower($this->current_attr_name)) { case 'country': $value = $this->out_CountrySelect($attr_value); break; case 'state': $value = $this->out_StatesSelect($attr_value); break; // case 'accountname': // case 'email': // if($this->current_group_name == 'Customer') // { // if($this->customer_obj->getPersonInfo('account') == $attr_value) // { // $value = prepareHTMLDisplay($attr_value); // break; // }; // }; // case 'accountname': // case 'email': // if($this->current_group_name == 'Customer') // { // if($this->customer_obj->getPersonInfo('account') == $attr_value) // { // $value = prepareHTMLDisplay($attr_value); // break; // }; // }; default: $input_type = 'text'; if (preg_match("/password\$/i", $this->current_attr_name)) { $input_type = "password"; } $value = '<input type="' . $input_type . '" ' . HtmlForm::genInputTextField(255, 'customer_info[' . $this->current_group_name . '][' . $this->current_attr_name . ']', 32, prepareHTMLDisplay($attr_value)) . ' />'; break; } break; } return $value; }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Local_AddPromoCode_URL': $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $request->setAction('AddPromoCode'); #$request->setKey( 'promo_code', '' ); $value = $request->getURL(); break; case 'Local_AddPromoCode_Error': $AddPromoCodeError = modApiFunc("PromoCodes", "getAddPromoCodeError"); modApiFunc("PromoCodes", "setAddPromoCodeError", ""); if (!empty($AddPromoCodeError)) { $value = getMsg('SYS', $AddPromoCodeError); } else { $value = ""; } break; case 'Local_RemovePromoCode_URL': $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $request->setAction('RemovePromoCode'); $value = $request->getURL(); break; case 'Local_PromoCode': $value = ''; if ($this->pc_info !== false) { $value = prepareHTMLDisplay($this->pc_info["promo_code"]); } break; case 'Local_PromoCodeDiscountedItemsListForCZ': $value = ''; if ($this->pc_info !== false && $this->applicable === true) { $home_present = false; $cat_names = array(); $prod_names = array(); if ($this->pc_info['cats'] != null) { $cats = explode('|', $this->pc_info['cats']); foreach ($cats as $cid) { $cat_obj = new CCategoryInfo($cid); if ($cat_obj->_fCategoryIDIsIncorrect === true) { continue; } // Home category present, we do not need anything else if ($cid == 1) { $home_present = true; $cat_names = array(); $cat_names[] = cz_getMsg('PROMOCODE_HOME_CATEGORY_NAME_SUBST'); break; } else { $cat_names[] = $cat_obj->getCategoryTagValue('Name'); } } } if ($this->pc_info['prods'] != null && !$home_present) { $prods = explode('|', $this->pc_info['prods']); foreach ($prods as $pid) { $obj = new CProductInfo($pid); if (!$obj->isProductIdCorrect()) { continue; } $prod_names[] = $obj->getProductTagValue('Name'); } } if ($cat_names) { $cat_names_str = implode(', ', $cat_names); if ($home_present) { $value .= $cat_names_str; } else { if (count($cat_names) == 1) { $value .= cz_getMsg("PROMOCODE_CATEGORY_LABEL") . $cat_names_str; } else { $value .= cz_getMsg("PROMOCODE_CATEGORIES_LABEL") . $cat_names_str; } } if ($prod_names) { $value .= cz_getMsg("PROMOCODE_AND_LABEL"); } } if ($prod_names) { $prod_names_str = implode(', ', $prod_names); if (count($prod_names) == 1) { $value .= cz_getMsg("PROMOCODE_PRODUCT_LABEL") . $prod_names_str; } else { $value .= cz_getMsg("PROMOCODE_PRODUCTS_LABEL") . $prod_names_str; } } } break; case 'Local_PromoCodeMinSubtotal': $value = ''; if ($this->pc_info !== false && $this->applicable === true && $this->pc_info["min_subtotal"] != 0) { $min_subtotal = modApiFunc("Localization", "currency_format", $this->pc_info["min_subtotal"]); $value = str_replace('{MINSUBTOTAL}', $min_subtotal, cz_getMsg('PROMOCODE_MINSUBTOTAL_NEEDED')); } break; case 'Local_PromoCodeDiscount': $value = ''; if ($this->pc_info !== false && $this->applicable === true) { $o_subtotal = modApiFunc("Checkout", "getOrderPrice", "Subtotal", modApiFunc("Localization", "getMainStoreCurrency")); $value = modApiFunc("Localization", "currency_format", modApiFunc("PromoCodes", "getPromoCodeDiscount", $o_subtotal, modApiFunc("PromoCodes", "getPromoCodeId"), array())); } if ($value == "") { $value = modApiFunc("Localization", "currency_format", PRICE_N_A); } break; case 'Local_PromoCodeDiscountText': // "10%" "$2" , // . $value = ""; if ($this->pc_info !== false && $this->applicable === true) { switch ($this->pc_info["discount_cost_type_id"]) { case 1: $value = modApiFunc("Localization", "currency_format", $this->pc_info["discount_cost"]); break; case 2: $value = modApiFunc("Localization", "num_format", $this->pc_info["discount_cost"]) . "%"; break; default: //: report error. exit(1); } } break; case 'Local_PromoCodeStrictCartAttitude': $value = ''; if ($this->pc_info && $this->pc_info['strict_cart'] == PROMO_CODE_STRICT_CART) { // get product IDs and their categories' IDs $prod = $coupon_cart = array(); $promo_codes = $application->getInstance('PromoCodes'); $order_cart = modApiFunc("Cart", "getCartContentExt"); foreach ($order_cart as $product) { $coupon_cart[] = array('id' => $product["ID"], 'cat' => $product['CategoryID'], 'total' => $product['TotalExcludingTaxes']); } // coupon not applicable due to not meeting coupon conditions if (false == $promo_codes->isPromoCodeAreaApplicable($this->pc_info, $coupon_cart)) { $value = cz_getMsg('PROMOCODE_STRICT_CART_NEEDED'); } } break; case 'Local_PromoCodeShippingAttitude': $value = ''; if ($this->pc_info !== false && $this->applicable === true) { if ($this->pc_info['free_shipping'] == PROMO_CODE_FORBIDS_FREE_SHIPPING) { $value = cz_getMsg('PROMOCODE_FREE_SHIPPING_FORBIDDEN'); } else { if ($this->pc_info['free_shipping'] == PROMO_CODE_GRANTS_FREE_SHIPPING) { $value = cz_getMsg('PROMOCODE_FREE_SHIPPING_GRANTED'); } } } break; case 'Local_PromoCodeHandlingAttitude': $value = ''; if ($this->pc_info !== false && $this->applicable === true) { if ($this->pc_info['free_handling'] == PROMO_CODE_FORBIDS_FREE_HANDLING) { $value = cz_getMsg('PROMOCODE_FREE_HANDLING_FORBIDDEN'); } else { if ($this->pc_info['free_handling'] == PROMO_CODE_GRANTS_FREE_HANDLING) { $value = cz_getMsg('PROMOCODE_FREE_HANDLING_GRANTED'); } } } break; case 'Local_PromoCodeGlobalDiscountIgnored': $value = ''; if ($this->pc_info !== false && $this->applicable === true) { if ($this->pc_info['b_ignore_other_discounts'] == 1) { // ignore global discount $value = cz_getMsg('PROMOCODE_GLOBAL_DISCOUNT_IGNORED'); } } break; default: $value = NULL; break; } return $value; }
/** * Fills the sort selert box */ function outputSortItems() { $output = ''; if (is_array($this->_found_pages)) { foreach ($this->_found_pages as $v) { $output .= '<option value="' . $v['page_id'] . '">' . prepareHTMLDisplay($v['name']) . '</option>'; } } return $output; }
function out_SearchForm() { global $application; $template_contents = array('SearchLettersList' => $this->out_SearchLettersList(), 'SearchLetterFilterSelect' => $this->out_SearchLetterFilterSelect(), 'SearchString' => $this->search_filter['type'] == 'custom' ? prepareHTMLDisplay($this->search_filter['search_string']) : '', 'SearchFormLabelColor' => $this->search_filter['type'] == 'custom' ? '#0000FF' : '#666666'); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $this->mTmplFiller =& $application->getInstance('TmplFiller'); return $this->mTmplFiller->fill("customer_account/customers_list/", "search-form.tpl.html", array()); }
/** * Prepares data to output a blocktag body. * * @return string - HTML code */ function outputBlockTemplates() { global $application; $retval = ""; foreach ($this->InfoTags as $actionId => $tags) { $i = 0; foreach ($tags['BlockTags'] as $blocktagId => $blocktagInfo) { $InfoTags = ""; foreach ($blocktagInfo['BlockInfoTags'] as $infotagId => $infotagName) { $InfoTags .= "<option value='" . $infotagId . "'>" . $infotagName . "</option>"; } $template_contents = array('I' => $i, 'BlockTagName' => $blocktagInfo['BlockTag'], 'BlocktagId' => $blocktagId, 'InfoTags' => $InfoTags, 'Display' => $this->notificationInfo["Action_id"] == $actionId ? "" : "display: none;", 'ActionId' => $actionId, 'Body' => prepareHTMLDisplay(modApiFunc("Notifications", "getNotificationBlockBody", $this->notificationInfo["Id"], $blocktagId))); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $retval .= modApiFunc('TmplFiller', 'fill', "notifications/mail_info/", "blocktag_template.tpl.html", array()); $i++; } } return $retval; }
/** * Outputs manufacturers as options for Manufacturer select box */ function getManufacturerList() { $man_list = modApiFunc('Manufacturers', 'getManufacturerProductAttributeValues', false, true); $output = ''; if (is_array($man_list) && !empty($man_list)) { foreach ($man_list as $v) { $output .= '<option value="' . $v['id'] . '"' . (@$this->Filter['manufacturer'] == $v['id'] ? ' selected="selected"' : '') . '>' . prepareHTMLDisplay($v['value']) . '</option>'; } } return $output; }
/** * Return the "Manufacturers -> Add Manufacturer" view html code. * */ function output() { global $application; loadCoreFile('html_form.php'); $this->Hints =& $application->getInstance('Hint'); $HtmlForm1 = new HtmlForm(); $this->MessageResources =& $application->getInstance('MessageResources', "manufacturers-messages", "AdminZone"); if ($this->ViewState["hasCloseScript"] == "true") { modApiFunc("application", "closeChild_UpdateParent"); return; } $manufacturer_summary = $this->outputManufacturerSummary(); $this->_Template_Contents = array("ManufacturerSummary" => $manufacturer_summary); $application->registerAttributes($this->_Template_Contents); $template_contents = array("Subtitle" => $this->outputSubtitle(), "Errors" => $this->outputErrors(), "ManufacturerId" => $this->outputManufacturerId(), "ManufacturerSummary" => $manufacturer_summary, "ManufacturerNameError" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_001']) ? $this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_001'] : "", "ManufacturerNameInputStyleClass" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_001']) ? "error" : "", "ManufacturerName" => $HtmlForm1->genInputTextField("128", "ManufacturerName", "75", prepareHTMLDisplay($this->POST["ManufacturerNameText"])), "ManufacturerIdFieldHint" => $this->Hints->getHintLink(array('MANUFACTURER_ID_NAME', 'manufacturers-messages')), "ManufacturerNameFieldHint" => $this->Hints->getHintLink(array('MNF_NAME_NAME', 'manufacturers-messages')), "ManufacturerImage" => getimage_input_az('mnf_image', $this->POST["ManufacturerImage"]), "ManufacturerImageFieldHint" => $this->Hints->getHintLink(array('MNF_IMAGE_NAME', 'manufacturers-messages')), "ManufacturerUrlError" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_004']) ? $this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_004'] : "", "ManufacturerUrlInputStyleClass" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_004']) ? "error" : "", "ManufacturerUrl" => $HtmlForm1->genInputTextField("128", "ManufacturerUrl", "75", prepareHTMLDisplay($this->POST["ManufacturerUrlText"] === NULL ? '' : $this->POST["ManufacturerUrlText"])), "ManufacturerUrlFieldHint" => $this->Hints->getHintLink(array('MNF_URL_NAME', 'manufacturers-messages')), "ManufacturerDescError" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_002']) ? $this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_002'] : "", "ManufacturerDescInputStyleClass" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_002']) ? "error" : "", "ManufacturerDesc" => $HtmlForm1->genInputTextAreaField("77", "ManufacturerDesc", "10"), "ManufacturerDescText" => prepareHTMLDisplay($this->POST["ManufacturerDescText"]), "ManufacturerDescFieldHint" => $this->Hints->getHintLink(array('MNF_DESC_NAME', 'manufacturers-messages')), "ManufacturerStatusError" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_003']) ? $this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_003'] : "", "ManufacturerStatusInputStyleClass" => isset($this->ErrorMessages['ERR_AZ_MNF_ADD_MNF_003']) ? "error" : "", "ManufacturerStatus" => $this->outputStatus(), "ManufacturerStatusFieldHint" => $this->Hints->getHintLink(array('MNF_STATUS_NAME', 'manufacturers-messages')), "AddManufacturerForm" => $HtmlForm1->genForm(modApiFunc("application", "getPagenameByViewname", "ManufacturersList", -1, -1, 'AdminZone'), "POST", "AddManufacturer"), "HiddenFormSubmitValue" => $HtmlForm1->genHiddenField("FormSubmitValue", "Save"), "HiddenArrayViewStateConstants" => $this->outputViewStateConstants(), "HiddenArrayViewState" => $this->outputViewState(), "SubmitSaveScript" => $HtmlForm1->genSubmitScript("AddManufacturerForm")); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); $SpecMessageResources =& $application->getInstance('MessageResources'); //: correct error codes return $output = $this->mTmplFiller->fill("manufacturers/add_manufacturer/", "list.tpl.html", array()); }
/** * @ describe the function AddCustomAttribute->getTag. */ function getTag($tag) { $value = null; switch ($tag) { case 'FormID': $value = $this->form['form_id']; break; case 'TypeID': $value = $this->form['type_id']; break; case 'ProductTypeID': $value = $this->form['product_type_id']; break; case 'ProductTypeName': $value = prepareHTMLDisplay($this->product_type_desc['name']); break; case 'AttributeTag': $value = prepareHTMLDisplay($this->form['view_tag']); break; case 'AttributeName': $value = prepareHTMLDisplay($this->form['name']); break; case 'AttributeDescr': $value = prepareHTMLDisplay($this->form['descr']); break; case 'AttributeInputTypeValues': $value = $this->form['input_type_values']; break; case 'AttributeDefault': $value = prepareHTMLDisplay($this->form['default']); break; case 'Errors': $value = $this->getErrors(); break; case 'Error': $value = $this->_error; break; case 'InputStyleClass': $value = $this->_error != '' ? "error" : ''; break; default: break; } return $value; }
/** * Gets search filter data text */ function getSearchFilterDataText() { // if empty filter -> returns empty string if (empty($this->psf_filter)) { return ''; } $output = array(); if ($this->psf_filter['pattern'] != '') { $line = getMsg('CTL', 'PSF_SEARCH_PATTERN') . ' '; if ($this->psf_filter['pattern_type'] == 'all') { $line .= '<b>' . getMsg('CTL', 'PSF_ALL_WORDS') . '</b>'; } elseif ($this->psf_filter['pattern_type'] == 'any') { $line .= '<b>' . getMsg('CTL', 'PSF_ANY_WORD') . '</b>'; } else { $line .= '<b>' . getMsg('CTL', 'PSF_EXACT_PHRASE') . '</b>'; } $line .= ' ' . getMsg('CTL', 'PSF_OF') . ' '; $line .= '<b>"' . prepareHTMLDisplay($this->psf_filter['pattern']) . '"</b>'; $line .= ' ' . getMsg('CTL', 'PSF_IN') . ' '; $in_fields = array(); if (isset($this->psf_filter['in_name'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_NAME_NAME') . '</b>'; } if (isset($this->psf_filter['in_id'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_ID_NAME') . '</b>'; } if (isset($this->psf_filter['in_sku'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_SKU_NAME') . '</b>'; } if (isset($this->psf_filter['in_descr'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_SHRDESCR_NAME') . '</b>'; } if (isset($this->psf_filter['in_det_descr'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_DETDESCR_NAME') . '</b>'; } if (isset($this->psf_filter['in_title'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_PAGETTL_NAME') . '</b>'; } if (isset($this->psf_filter['in_keywords'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_METAKWRD_NAME') . '</b>'; } if (isset($this->psf_filter['in_meta_descr'])) { $in_fields[] = '<b>' . getMsg('SYS', 'PRD_METADESCR_NAME') . '</b>'; } $line .= join(', ', $in_fields); $output[] = $line; } if ($this->psf_filter['category'] > 0) { $line = getMsg('CTL', 'PSF_CATEGORY') . ' '; $tmp_info = new CCategoryInfo($this->psf_filter['category']); $line .= '<b>' . $tmp_info->getCategoryTagValue('name') . '</b>'; if (isset($this->psf_filter['recursive'])) { $line .= ' (' . _ml_strtolower(getMsg('CTL', 'PSF_INCLUDE_SUBCATEGORIES')) . ')'; } $output[] = $line; } if ($this->psf_filter['manufacturer'] > 0) { $line = getMsg('CTL', 'PSF_MANUFACTURER') . ' '; $tmp_info = modApiFunc('Manufacturers', 'getManufacturerInfo', $this->psf_filter['manufacturer']); $line .= '<b>' . $tmp_info['manufacturer_name'] . '</b>'; $output[] = $line; } if ($this->psf_filter['price_min'] !== '' || $this->psf_filter['price_max'] !== '') { $line = getMsg('CTL', 'PSF_PRICE_RANGE') . ' '; $line .= $this->psf_filter['price_min'] !== '' ? '<b>' . $this->psf_filter['price_min'] . '</b>' : '<b>0.00</b>'; $line .= $this->psf_filter['price_max'] !== '' ? ' - <b>' . $this->psf_filter['price_max'] . '</b>' : '<b>+</b>'; $output[] = $line; } // request to reset filter $request = new Request(); $request->setView('ProductList'); $request->setAction('SetCurrCat'); $request->setKey('category_id', 1); $request = $request->getURL(); $output[] = '<input type="hidden" value="0" id="categoryval_id" /><a href="javascript:gotoCategory();" style="font-weight:bold; font-size:11px; color:#000; font-family:Tahoma,sans-serif; text-decoration:underline;">' . getMsg('CTL', 'PSF_RESET_FILTER') . '</a>'; $output[] = ''; // $output[] = '<div class="button button_10em" title="' . getMsg('CTL', 'PSF_RESET_FILTER') . '" onclick="javascript:go(\'' . $request . '\');">' . getMsg('CTL', 'PSF_RESET_FILTER') . '</div>'; if (count($this->psf_filter['result']) > 1) { $output[] = getMsg('CTL', 'PSF_SHOWING') . ' ' . '<b>' . $this->From . '</b> - <b>' . $this->To . '</b>' . ' ' . getMsg('CTL', 'PSF_OF') . ' <b>' . (count($this->psf_filter['result']) - 1) . '</b>'; } else { $output[] = getMsg('CTL', 'PSF_NO_PRODUCTS_FOUND'); } if (@$this->psf_filter['overflow']) { $output[] = ' <span style="color: red">' . getMsg('CTL', 'PSF_OVERFLOWTEXT') . '</span>'; } return join('<br />', $output); }
function getTag($tag) { global $application; $value = null; switch ($tag) { case 'Local_Items': $value = $this->getItemList(); break; # paginator # paginator case 'PaginatorLine': $obj =& $application->getInstance($tag); $value = $obj->output($this->paginator_name, "GiftCertificateListView", 'PGNTR_GC_ITEMS'); break; # override the PaginatorRows tag behavior # override the PaginatorRows tag behavior case 'PaginatorRows': $obj =& $application->getInstance($tag); $value = $obj->output($this->paginator_name, "GiftCertificateListView", 'PGNTR_GC_ITEMS'); break; case 'Local_Dell_GC_Href': $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $request->setAction('GiftCertificateDellAction'); $request->setKey('gc_code', ''); $value = $request->getURL(); break; default: if (strpos($tag, 'Local_') === 0) { $gc_field = substr(strtolower($tag), strlen('local_')); if (isset($this->__gc_item[$gc_field])) { switch ($gc_field) { case 'gc_amount': case 'gc_remainder': $value = modApiFunc('Localization', 'currency_format', $this->__gc_item[$gc_field]); break; case 'gc_date_created': $value = modApiFunc('Localization', 'date_format', intval($this->__gc_item[$gc_field])); break; case 'gc_sendtype': if ($this->__gc_item[$gc_field] == GC_SENDTYPE_EMAIL) { $value = getMsg('GCT', 'GC_SENDTYPE_EMAIL'); } if ($this->__gc_item[$gc_field] == GC_SENDTYPE_POST) { $value = getMsg('GCT', 'GC_SENDTYPE_POST'); } break; case 'gc_status': if ($this->__gc_item[$gc_field] == GC_STATUS_ACTIVE) { $value = getMsg('GCT', 'GC_STATUS_ACTIVE'); } if ($this->__gc_item[$gc_field] == GC_STATUS_BLOCKED) { $value = getMsg('GCT', 'GC_STATUS_BLOCKED'); } if ($this->__gc_item[$gc_field] == GC_STATUS_PENDING) { $value = getMsg('GCT', 'GC_STATUS_PENDING'); } break; default: $value = prepareHTMLDisplay($this->__gc_item[$gc_field]); break; } } } break; } return $value; }
/** * Returns Category info tag value. * * @param string $tag Short tag name * @param int $localized The parameter defines, whether to return localized * values or to send as values the constants CATEGORYINFO_LOCALIZED_DATA or * CATEGORYINFO_NOT_LOCALIZED_DATA directly from the DB * @return string Tag value **/ function getCategoryTagValue($tag, $localized = CATEGORYINFO_DEFAULT_LOCALIZED_MODE) { global $application; /* If creating an object the incorrect id was passed to the category, then it will return an empty value of any tag. */ if ($this->_fCategoryIDIsIncorrect == true) { return $this->debugmode ? 'Category ID is incorrect' : ''; } # Check additional tags if (array_key_exists($tag, $this->_fAdditionalTagList)) { return $this->_fAdditionalTagList[$tag]; } # Check localization request if ($localized == CATEGORYINFO_LOCALIZED_DATA) { $this->localized = true; } elseif ($localized == CATEGORYINFO_NOT_LOCALIZED_DATA) { $this->localized = false; } # Get Tag value $tag = _ml_strtolower(trim($tag)); switch ($tag) { # # Process artificial tags # case $this->_fArtificialTagList['id']: return $this->_fCategoryID; break; case $this->_fArtificialTagList['name']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['name']) : $this->_fBaseCategoryInfo[0]['name']; break; case $this->_fArtificialTagList['status']: $cat_status = ""; $MessageResources =& $application->getInstance('MessageResources'); switch ($this->_fBaseCategoryInfo[0]['status']) { case CATEGORY_STATUS_ONLINE: $cat_status = $MessageResources->getMessage('CAT_STATUS_ONLINE'); break; case CATEGORY_STATUS_OFFLINE: $cat_status = $MessageResources->getMessage('CAT_STATUS_OFFLINE'); break; default: //: report error $cat_status = ""; } return $this->localized ? prepareHTMLDisplay($cat_status) : $this->_fBaseCategoryInfo[0]['status']; break; case $this->_fArtificialTagList['description']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['descr']) : $this->_fBaseCategoryInfo[0]['descr']; break; case $this->_fArtificialTagList['largeimage']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } $_src = $this->_fImagesData['largeimage_file']['URL']; $_width = $this->_fImagesData['largeimage_file']['WIDTH']; $_height = $this->_fImagesData['largeimage_file']['HEIGHT']; $_alttext = $this->getCategoryTagValue('imagealttext'); return '<img src="' . $_src . '" width="' . $_width . '" height="' . $_height . '" alt="' . $_alttext . '" />'; break; case $this->_fArtificialTagList['largeimagesrc']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['largeimage_file']['URL']; break; case $this->_fArtificialTagList['largeimagewidth']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['largeimage_file']['WIDTH']; break; case $this->_fArtificialTagList['largeimageheight']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['largeimage_file']['HEIGHT']; break; case $this->_fArtificialTagList['smallimage']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } $_src = $this->_fImagesData['smallimage_file']['URL']; $_width = $this->_fImagesData['smallimage_file']['WIDTH']; $_height = $this->_fImagesData['smallimage_file']['HEIGHT']; $_alttext = $this->getCategoryTagValue('imagealttext'); return '<img src="' . $_src . '" width="' . $_width . '" height="' . $_height . '" alt="' . $_alttext . '" />'; break; case $this->_fArtificialTagList['smallimagesrc']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['smallimage_file']['URL']; break; case $this->_fArtificialTagList['smallimagewidth']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['smallimage_file']['WIDTH']; break; case $this->_fArtificialTagList['smallimageheight']: if ($this->_fImagesData === null) { $this->_getImageInfo(); } return $this->_fImagesData['smallimage_file']['HEIGHT']; break; case $this->_fArtificialTagList['imagealttext']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['image_descr']) : $this->_fBaseCategoryInfo[0]['image_descr']; break; case $this->_fArtificialTagList['pagetitle']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['page_title']) : $this->_fBaseCategoryInfo[0]['page_title']; break; case $this->_fArtificialTagList['metakeywords']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['meta_keywords']) : $this->_fBaseCategoryInfo[0]['meta_keywords']; break; case $this->_fArtificialTagList['metadescription']: return $this->localized ? prepareHTMLDisplay($this->_fBaseCategoryInfo[0]['meta_descr']) : $this->_fBaseCategoryInfo[0]['meta_descr']; break; case $this->_fArtificialTagList['productsnumber']: // : , // if ($this->getShowProductsRecursivelyStatus() == CATEGORY_SHOW_PRODUCTS_RECURSIVELY) { $select_mode_recursiveness = IN_CATEGORY_RECURSIVELY; } else { $select_mode_recursiveness = IN_CATEGORY_ONLY; } return $this->_getProductsNumberInCategory($select_mode_recursiveness, UNIQUE_PRODUCTS); break; case $this->_fArtificialTagList['productsnumberrecursively']: return $this->_getProductsNumberInCategory(IN_CATEGORY_RECURSIVELY, UNIQUE_PRODUCTS); break; case $this->_fArtificialTagList['productsnumber_non_recursively']: return $this->_getProductsNumberInCategory(IN_CATEGORY_ONLY, UNIQUE_PRODUCTS); break; case $this->_fArtificialTagList['productsnumberrecursively_all_product_links']: return $this->_getProductsNumberInCategory(IN_CATEGORY_RECURSIVELY, ALL_PRODUCT_LINKS); break; case $this->_fArtificialTagList['offlineandonlinesubcategoriesnumber']: if ($this->_fSubcategoriesNumber == null) { $this->_fSubcategoriesNumber = sizeof(modApiFunc('Catalog', 'getSubcategoriesFullListWithParent', $this->_fBaseCategoryInfo[0]['id'], false)) - 1; } return $this->_fSubcategoriesNumber; case $this->_fArtificialTagList['hasonlinesubcategories']: return modApiFunc('Catalog', 'hasOnlineSubcategories', $this->_fBaseCategoryInfo[0]['id']); case $this->_fArtificialTagList['subcategoriesnumber']: $OnlineSubCategories = $this->_getOnlineSubcategories(); $n_subcategories_including_current = sizeof($OnlineSubCategories); // (Navigator AZ) , // . // _loadOnlineSubCategories Id Online , // id , Online, . return $n_subcategories_including_current > 0 ? $n_subcategories_including_current - 1 : $n_subcategories_including_current; // current is itself offline break; case $this->_fArtificialTagList['left']: return $this->_fBaseCategoryInfo[0]['left1']; break; case $this->_fArtificialTagList['right']: return $this->_fBaseCategoryInfo[0]['right1']; break; case $this->_fArtificialTagList['level']: return $this->_fBaseCategoryInfo[0]['level']; break; case $this->_fArtificialTagList['parentid']: if ($this->_fParentCategoryID == null) { $this->_fParentCategoryID = modApiFunc('Catalog', 'getParentCategoryId', $this->_fCategoryID); } return $this->_fParentCategoryID; break; case $this->_fArtificialTagList['recursivestatus']: $this->_loadRecursiveStatus(); $cat_status = ""; $MessageResources =& $application->getInstance('MessageResources'); switch ($this->_fRecursiveStatus) { case CATEGORY_STATUS_ONLINE: $cat_status = $MessageResources->getMessage('CAT_STATUS_ONLINE'); break; case CATEGORY_STATUS_OFFLINE: $cat_status = $MessageResources->getMessage('CAT_STATUS_OFFLINE'); break; default: //: report error $cat_status = ""; } return $this->localized ? prepareHTMLDisplay($cat_status) : $this->_fRecursiveStatus; break; case $this->_fArtificialTagList['link']: $_request = new Request(); $_request->setView('NavigationBar'); $_request->setAction("SetCurrCat"); $_request->setKey("category_id", $this->_fCategoryID); $_request->setCategoryID($this->_fCategoryID); $_url = $_request->getURL(); return $_url; break; case $this->_fArtificialTagList['seo_url_prefix']: return $this->_fBaseCategoryInfo[0]['seo_url_prefix']; break; case $this->_fArtificialTagList['showproductsrecursivelystatus']: $raw_status = $this->_fBaseCategoryInfo[0]['show_prod_recurs']; $obj =& $application->getInstance('MessageResources'); if ($this->localized) { if ($raw_status == CATEGORY_DONOTSHOW_PRODUCTS_RECURSIVELY) { return $obj->getMessage('CATEGORY_DONOTSHOW_PRODUCTS_RECURSIVELY'); } else { return $obj->getMessage('CATEGORY_SHOW_PRODUCTS_RECURSIVELY'); } } else { return $raw_status; } break; # If the tag is not defined, return an empty string. # If the tag is not defined, return an empty string. default: return $this->debugmode ? 'The tag is undefined:' . $tag : ''; } }
/** * Action: UpdateCurrencies. * */ function onAction() { global $application; $SessionPost = array(); $SessionPost = $_POST; $Errors = array(); $Result = array(); $current_msc = modApiFunc("Localization", "getMainStoreCurrency"); $current_msc_code = modApiFunc("Localization", "getCurrencyCodeById", $current_msc); switch ($SessionPost["ViewState"]["FormSubmitValue"]) { case "setMSC": $new_msc = isset($SessionPost["new_msc"]) ? $SessionPost["new_msc"] : $current_msc; $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $new_msc); $cur_name = isset($SessionPost["new_msc_name"]) ? trim(prepareHTMLDisplay($SessionPost["new_msc_name"])) : ""; if ($cur_name == '') { // $Errors["MSC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_EMPTY_MSC_NAME")); } // if ($new_msc != $current_msc) { // modApiFunc("Localization", "clearActiveAndDefaultCurrenciesList"); // modApiFunc("Localization", "updateCurrency", $new_msc, $cur_name, "true", "true", "true"); // modApiFunc("Currency_Converter", "delAllManualRates"); // PM/SM required currencies modApiFunc("Checkout", "setPM_SM_RequiredCurrencieslist"); // $Result["MSC"][0] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "CC_RESULT_MSC_CHANGED")); break; } else { if ($cur_name != '') { // modApiFunc("Localization", "updateCurrency", $new_msc, $cur_name, "true", "true"); // $Result["MSC"][0] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "CC_RESULT_MSC_NAME_CHANGED")); break; } } break; case "deleteAC": $cur_id = isset($SessionPost["currency_id"]) ? $SessionPost["currency_id"] : 0; $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); $req = modApiFunc("Checkout", "getPM_SM_RequiredCurrenciesList"); if (isset($req[$cur_code])) { // cannot delete technical currency $Errors["MSC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_CANNOT_DELETE_TECHNICAL")); break; } // modApiFunc("Localization", "updateCurrency", $cur_id, "", "false", "false", "false"); // $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); modApiFunc("Currency_Converter", "delManualRateByCode", $cur_code); // $Result["AC"][0] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "CC_RESULT_AC_DELETED")); break; case "updateRateAC": $cur_id = isset($SessionPost["currency_id"]) ? $SessionPost["currency_id"] : 0; $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); if ($cur_code == NULL) { break; } // $rate = modApiFunc("Currency_Converter", "getRateFromWeb", $cur_code, $current_msc_code); if ($rate == false) { // , $Errors["AC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_CANNOT_OBTAIN_RATE_FROM_WEB")); break; } // $rate = number_format($rate, 4, '.', ''); modApiFunc("Currency_Converter", "delManualRateByCode", $cur_code); modApiFunc("Currency_Converter", "addManualRate", $current_msc_code, $cur_code, $rate); // $Result["AC"][0] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "CC_RESULT_AC_RATE_UPDATED")); break; case "newAC": $cur_id = isset($SessionPost["new_currency_select"]) ? $SessionPost["new_currency_select"] : 0; $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); $method = isset($SessionPost["rate_method"]) ? $SessionPost["rate_method"] : 1; $rate = isset($SessionPost["new_rate"]) ? $SessionPost["new_rate"] : null; $visibility = isset($SessionPost["new_currency_visible"]) && $SessionPost["new_currency_visible"] == 'on' ? 'true' : 'false'; $rlt = modApiFunc("Localization", "addNewAdditionalCurrency", $cur_id, $method, $rate, $visibility); if ($rlt === true) { $Result["NewAC"][0] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "CC_RESULT_NEWAC_CURRENCY_ADDED")); } else { switch ($rlt) { case STORE_CURRENCIES_CANNOT_ADD_MAIN_AS_ADDITIONAL: $Errors["NewAC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_CANNOT_ADD_MAIN_AS_ADDITIONAL")); break; case STORE_CURRENCIES_CANNOT_ADD_DUPLICATE: $Errors["NewAC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_CANNOT_ADD_DUPLICATE")); break; case STORE_CURRENCIES_INVALID_MANUAL_RATE_ERROR: $Errors["NewAC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_INVALID_MANUAL_RATE_ERROR")); break; case STORE_CURRENCIES_CANNOT_OBTAIN_NEW_RATE_FROM_WEB: $Errors["NewAC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_CANNOT_OBTAIN_NEW_RATE_FROM_WEB")); break; } } break; case "updateAC": // , - $currencies = isset($SessionPost["ac"]) ? $SessionPost["ac"] : array(); if (empty($currencies)) { break; } // foreach ($currencies as $cur_id) { $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); $visibility = isset($SessionPost["visible_{$cur_id}"]) && $SessionPost["visible_{$cur_id}"] == 'on' ? 'true' : 'false'; // $cur_name = isset($SessionPost["cname_{$cur_id}"]) ? trim(prepareHTMLDisplay($SessionPost["cname_{$cur_id}"])) : ''; if ($cur_name == '') { $Errors["AC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_EMPTY_NAME")); continue; } // $rate = isset($SessionPost["crate_{$cur_id}"]) ? $SessionPost["crate_{$cur_id}"] : 0; $rate = number_format($rate, 4, '.', ''); if ($rate == 0) { $Errors["AC"][] = str_replace("{CURRENCY_CODE}", $cur_code, getMsg('CC', "STORE_CURRENCIES_INVALID_RATE")); continue; } // modApiFunc("Localization", "updateCurrency", $cur_id, $cur_name, "true", "false", $visibility); // , , $cur_code = modApiFunc("Localization", "getCurrencyCodeById", $cur_id); modApiFunc("Currency_Converter", "delManualRateByCode", $cur_code); modApiFunc("Currency_Converter", "addManualRate", $current_msc_code, $cur_code, $rate); // $Result["AC"][0] = getMsg('CC', "CC_RESULT_AC_CURRENCIES_UPDATED"); } break; default: _fatal(array("CODE" => "CORE_051"), __CLASS__, __FUNCTION__, $SessionPost["ViewState"]["FormSubmitValue"]); break; } if (isset($Errors["MSC"]) && !empty($Errors["MSC"])) { modApiFunc('Session', 'set', 'MSC_Errors', $Errors["MSC"]); } if (isset($Errors["AC"]) && !empty($Errors["AC"])) { modApiFunc('Session', 'set', 'AC_Errors', $Errors["AC"]); } if (isset($Errors["NewAC"]) && !empty($Errors["NewAC"])) { modApiFunc('Session', 'set', 'NewAC_Errors', $Errors["NewAC"]); } if (isset($Result["MSC"]) && !empty($Result["MSC"])) { modApiFunc('Session', 'set', 'MSC_Result', $Result["MSC"]); } if (isset($Result["AC"]) && !empty($Result["AC"])) { modApiFunc('Session', 'set', 'AC_Result', $Result["AC"]); } if (isset($Result["NewAC"]) && !empty($Result["NewAC"])) { modApiFunc('Session', 'set', 'NewAC_Result', $Result["NewAC"]); } $request = new Request(); $request->setView('PopupWindow'); $request->setKey("page_view", "CurrencyRateEditor"); $application->redirect($request); }
/** * Outputs the Filter form */ function outputLabelFilter() { global $application; $template_contents = array('DefLanguage' => modApiFunc('MultiLang', 'getDefaultLanguage'), 'Language' => $this->_search_filter['lng'], 'ActionField' => '<input type="hidden" ' . HtmlForm::genHiddenField('asc_action', 'FilterLabels') . ' />', 'HLAllLabels' => $this->outputLabel('ShowAllLabels'), 'HLSFLabels' => $this->outputLabel('ShowStorefrontLabels'), 'HLCLabels' => $this->outputLabel('ShowCustomLabels'), 'HLNTLabels' => $this->outputLabel('ShowNonTranslatedLabels'), 'HLTLabels' => $this->outputLabel('ShowTranslatedLabels'), 'HLLanguage' => $this->outputLabel('FilterLabels', 'lng'), 'HLLabel' => $this->outputLabel('FilterLabels', 'label'), 'HLLPattern' => $this->outputLabel('FilterLabels', 'pattern'), 'HLLType' => $this->outputLabel('FilterLabels', 'type'), 'HLLStatus' => $this->outputLabel('FilterLabels', 'status'), 'CountAll' => $this->outputCount('all'), 'CountSF' => $this->outputCount('storefront'), 'CountC' => $this->outputCount('custom'), 'CountNT' => $this->outputCount('nontranslated'), 'CountT' => $this->outputCount('translated'), 'LangSelect' => $this->outputLangSelect(), 'LabelField' => '<input class="form-control input-sm input-large" type="text"' . HtmlForm::genInputTextField('255', 'label', 60, prepareHTMLDisplay(@$this->_search_filter['label']['value'])) . ' />', 'LabelCheckBox' => HtmlForm::genCheckbox(array('value' => 'Y', 'is_checked' => @$this->_search_filter['label']['exactly'] == 'Y' ? 'checked' : '', 'name' => 'label_exactly', 'id' => 'label_exactly'), "class=''"), 'ValueField' => '<input class="form-control input-sm input-large" type="text"' . HtmlForm::genInputTextField('255', 'pattern', 60, prepareHTMLDisplay(@$this->_search_filter['pattern']['value'])) . ' />', 'ValueCheckBox' => HtmlForm::genCheckbox(array('value' => 'Y', 'is_checked' => @$this->_search_filter['pattern']['exactly'] == 'Y' ? 'checked' : '', 'name' => 'label_pattern_exactly', 'id' => 'label_pattern_exactly'), "class=''"), 'TypeSelect' => $this->outputTypeSelect(), 'StatusSelect' => HtmlForm::genDropdownSingleChoice(array('select_name' => 'status', 'selected_value' => @$this->_search_filter['status'], 'id' => 'status', 'values' => array(array('value' => 'all', 'contents' => getMsg('ML', 'ML_ALL_LABELS')), array('value' => 'translated', 'contents' => getMsg('ML', 'ML_TRANSLATED_LABELS')), array('value' => 'nontranslated', 'contents' => getMsg('ML', 'ML_NON_TRANSLATED_LABELS')))))); $this->_Template_Contents = $template_contents; $application->registerAttributes($this->_Template_Contents); return $this->mTmplFiller->fill('multilang/label_editor/', 'label_filter.tpl.html', array()); }
/** * Outputs review template if available. If not outputs nothing */ function outputReview() { global $application; // checking if posting message is available for the product // Note: checking other aspects (if module is turned on and so on) // was done before if (!in_array($this->_product_data['product_cr'], array(5, 6))) { return ''; } $_tags = array('Local_ReviewText' => prepareHTMLDisplay(@$this->_data['review'])); $this->_Template_Contents = $_tags; $application->registerAttributes($this->_Template_Contents); return $this->mTmplFiller->fill($this->_templates['review']); }