Пример #1
0
 /**
  * Admin_Action_Default
  * This is the method that is run when an admin user views the addon.
  *
  * If there are no log entries to worry about, then it will show the 'Addon_systemlog_logs_empty' file from the templates/ folder
  * and then quickly return out of the function.
  *
  * If there are log entries to worry about, it will work out the paging for the top of the list
  * then show buttons to allow you to delete selected entries or delete all log entries at once
  *
  * If you want to view a particular log entry, click the '+' next to the relevant log summary and it will expand to show more detail
  *
  * @uses db
  * @uses template_system
  * @uses InterspireTemplate::GetTemplatePath()
  * @uses InterspireTemplate::SetTemplatePath()
  * @uses InterspireTemplate::ParseTemplate()
  * @uses InterspireTemplate::Assign()
  * @uses GetFlashMessages
  * @uses perpage
  * @uses show_max_pages
  * @uses admin_url
  * @uses GetId
  *
  * @return Void Instead of returning anything, the list of log entries (if any) are shown directly.
  */
 public function Admin_Action_Default()
 {
     $flash_messages = GetFlashMessages();
     $this->template_system->Assign('FlashMessages', $flash_messages, false);
     $number_of_logs = $this->db->FetchOne("SELECT count(logid) AS count FROM " . $this->db->TablePrefix . "log_system_system");
     if ($number_of_logs == 0) {
         $curr_template_dir = $this->template_system->GetTemplatePath();
         $this->template_system->SetTemplatePath(SENDSTUDIO_TEMPLATE_DIRECTORY);
         $GLOBALS['Error'] = GetLang('Addon_systemlog_Logs_Empty');
         $error = $this->template_system->ParseTemplate('errormsg', true);
         $this->template_system->SetTemplatePath($curr_template_dir);
         $this->template_system->Assign('Addon_systemlog_Logs_Empty', $error, false);
         $this->template_system->ParseTemplate('logs_empty');
         return;
     }
     $paging = $this->SetupPaging($this->admin_url, $number_of_logs);
     $this->template_system->Assign('Paging', $paging, false);
     $perpage = $this->GetPerPage();
     // paging always starts at '1' - so take one off so we get the right offset.
     $page_number = $this->GetCurrentPage() - 1;
     $offset = $page_number * $perpage;
     $qry = "SELECT logid, logseverity, logtype, logmodule, logsummary, logdate FROM " . $this->db->TablePrefix . "log_system_system ORDER BY logid DESC " . $this->db->AddLimit($offset, $perpage);
     $result = $this->db->Query($qry);
     $this->template_system->Assign('AddonId', $this->GetId());
     while ($row = $this->db->Fetch($result)) {
         $row['rowid'] = 'addon_' . $this->GetId() . '_' . $row['logid'];
         if ($row['logmodule'] === '') {
             $row['logmodule'] = 'Internal';
         }
         if (strlen($row['logsummary']) > 170) {
             $row['logsummary'] = substr($row['logsummary'], 0, 166) . ' ...';
         }
         $row['logsummary'] = htmlspecialchars($row['logsummary']);
         $row['logdate'] = gmdate('M d Y H:i:s', $row['logdate']);
         $image = 'error.gif';
         $severity = 'Error';
         switch ($row['logseverity']) {
             case 1:
                 $severity = 'Success';
                 $image = 'success.gif';
                 break;
             case 2:
                 $severity = 'Notice';
                 $image = 'notice.gif';
                 break;
             case 3:
                 $severity = 'Warning';
                 $image = 'warning.gif';
                 break;
         }
         $row['image'] = $image;
         $row['severity'] = $severity;
         $log_entries[] = $row;
     }
     $this->template_system->Assign('AdminUrl', $this->admin_url, false);
     $this->template_system->Assign('TemplateUrl', $this->template_url, false);
     $this->template_system->Assign('logsList', $log_entries, false);
     $this->template_system->ParseTemplate('logs_display');
 }
Пример #2
0
		public function ManageFormFields($msgDesc='', $msgStatus='')
		{
			if ($msgDesc !== '') {
				$GLOBALS['Message'] = MessageBox($msgDesc, $msgStatus);
			}

			$flashMessages = GetFlashMessages();

			if (is_array($flashMessages) && !empty($flashMessages)) {
				$GLOBALS['Message'] = '';
				foreach ($flashMessages as $flashMessage) {
					$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
				}
			}

			$GLOBALS['FormFieldsGrid'] = $this->ManageFormFieldsGrid();
			$GLOBALS['FormFieldsAddField'] = sprintf(GetLang('FormFieldsAddField'), GetLang('FormFieldsSectionAccount'));
			$GLOBALS['FormFieldsOptions'] = '';
			$availableFields = $GLOBALS['ISC_CLASS_FORM']->getAvailableFields();

			if (is_array($availableFields)) {
				foreach ($availableFields as $name => $desc) {
					$GLOBALS['FormFieldsOptions'] .= '<li><a href="#" onclick="AddFormField(\'' . isc_html_escape($name) . '\'); return false;" style="background-image:url(\'images/fields/' . $desc['img'] . '\'); background-repeat:no-repeat; background-position:5px 5px; padding-left:28px; width:auto;">' . isc_html_escape($desc['name']) . '</a></li>';
				}
			}

			$GLOBALS['FormFieldsSectionAccount'] = sprintf(GetLang('FormFieldsSectionTab'), GetLang('FormFieldsSectionAccount'));
			$GLOBALS['FormFieldsSectionAddress'] = sprintf(GetLang('FormFieldsSectionTab'), GetLang('FormFieldsSectionAddress'));

			$GLOBALS['FormFieldsAccountFormId'] = FORMFIELDS_FORM_ACCOUNT;
			$GLOBALS['FormFieldsAddressFormId'] = FORMFIELDS_FORM_ADDRESS;

			if(!gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['HideFormFieldsButtons'] = 'display: none';
			}

			$GLOBALS['FormFieldsHideAddButton'] = '';
			if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Add_FormFields) || !gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['FormFieldsHideAddButton'] = 'none';
			}

			$GLOBALS['FormFieldsHideDeleteButton'] = '';
			if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_FormFields) || !gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['FormFieldsHideDeleteButton'] = 'none';
			}

			$GLOBALS['FormFieldsIsSortable'] = '';
			if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_FormFields)) {
				$GLOBALS['FormFieldsIsSortable'] = '1';
			}

			$this->template->display('formfields.manage.tpl');
		}
Пример #3
0
 /**
  * Admin_Action_Templates_Default
  * Prints the list of templates
  *
  * @return Void Returns nothing
  */
 public function Admin_Action_Templates_Default()
 {
     $api = self::getApi();
     $user = GetUser();
     /**
      * Add the add button and print flash messages
      */
     $this->template_system->Assign('Add_Button', $this->template_system->ParseTemplate('add_survey_template_button', true), false);
     $this->template_system->Assign('Message', GetFlashMessages(), false);
     /**
      * If there are no templates print an empty message
      */
     $numsurveys = $api->GetTemplates($user->userid, 0, 0, array(), array(), true);
     if ($numsurveys == 0) {
         $this->template_system->ParseTemplate('manage_templates_empty');
         return;
     }
     /**
      * The default sort details
      */
     $sort_details = array('SortBy' => 'name', 'Direction' => 'asc');
     /**
      * If valid sorting details are given overwrite the defaults
      */
     if (isset($_GET['SortBy']) && in_array(strtolower($_GET['SortBy']), $api->validSorts)) {
         $sort_details['SortBy'] = strtolower($_GET['SortBy']);
     }
     if (in_array(strtolower($_GET['Direction']), array('up', 'down'))) {
         $direction = strtolower($_GET['Direction']);
         if ($direction == 'up') {
             $sort_details['Direction'] = 'asc';
         } else {
             $sort_details['Direction'] = 'desc';
         }
     }
     $perpage = $this->GetPerPage();
     if (isset($_GET['PerPageDisplay'])) {
         $perpage = (int) $_GET['PerPageDisplay'];
         $this->SetPerPage($perpage);
     }
     $page = (int) $_GET['DisplayPage'];
     if ($page < 1) {
         $page = 1;
     }
     $paging = $this->SetupPaging($this->admin_url, $numsurveys);
     $this->template_system->Assign('Paging', $paging, false);
     $search_info = array();
     $surveys = $api->GetTemplates($user->userid, $page, $perpage, $search_info, $sort_details, false);
     $survey_rows = '';
     foreach ($surveys as $survey) {
         $this->template_system->Assign('name', $survey['name']);
         $this->template_system->Assign('surveyid', $survey['surveyid']);
         $this->template_system->Assign('created', AdjustTime($survey['created'], false, GetLang('DateFormat'), true));
         /**
          * add the edit link
          */
         $editlink = '<a href="' . $this->admin_url . '&Action=Edit&id=' . $survey['surveyid'] . '">' . GetLang('Edit') . '</a>';
         $this->template_system->Assign('edit_link', $editlink, false);
         /**
          * add the delete link
          */
         $deletelink = '<a href="' . $this->admin_url . '&Action=Delete&id=' . $survey['surveyid'] . '">' . GetLang('Delete') . '</a>';
         $this->template_system->Assign('delete_link', $deletelink, false);
         $survey_rows .= $this->template_system->ParseTemplate('manage_surveys_row', true);
     }
     $this->template_system->Assign('Items', $survey_rows, false);
     $this->template_system->ParseTemplate('templates_manage');
 }
Пример #4
0
		/**
		 * Edit a customer page
		 *
		 * Method will construct the edit customer page
		 *
		 * @access public
		 * @param string $MsgDesc The optional message to display
		 * @param string $MsgStatus The optional status of the message
		 * @param bool $PreservePost TRUE to use the REQUEST variable, FALSE to read from the database. Default is FALSE
		 * @return Void
		 */
		public function EditCustomerStep1($MsgDesc = "", $MsgStatus = "", $PreservePost=false)
		{
			if ($MsgDesc != "") {
				$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
			}

			$flashMessages = GetFlashMessages();
			if(is_array($flashMessages) && !empty($flashMessages)) {
				$GLOBALS['Message'] = '';
				foreach($flashMessages as $flashMessage) {
					$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
				}
			}

			// Show the form to edit a customer
			$customerId = isc_html_escape((int)$_GET['customerId']);

			// Make sure the customer exists
			if (!CustomerExists($customerId)) {
				// The customer doesn't exist
				if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) {
					$this->ManageCustomers(GetLang('CustomerDoesntExist'), MSG_ERROR);
				} else {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
				}
				return;
			}

			if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Add_Customer)) {
				$GLOBALS['CustomerAddressAddDisabled'] = 'DISABLED';
			}

			if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) {
				$GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED';
			}

			if (GetConfig('CurrencyLocation') == 'right') {
				$GLOBALS['CurrencyTokenLeft'] = '';
				$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
			} else {
				$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
				$GLOBALS['CurrencyTokenRight'] = '';
			}

			if ($PreservePost == true) {
				$customer = $this->_GetCustomerData(0);
			} else {
				$customer = $this->_GetCustomerData($customerId);
			}

			if (isset($_REQUEST['currentTab'])) {
				$GLOBALS['CurrentTab'] = (int)$_REQUEST['currentTab'];
			} else {
				$GLOBALS['CurrentTab'] = 0;
			}

			$query = "SELECT *
						FROM [|PREFIX|]shipping_addresses
						WHERE shipcustomerid='" . $GLOBALS['ISC_CLASS_DB']->Quote((int)$customerId) . "'";

			if ($GLOBALS['ISC_CLASS_DB']->CountResult($GLOBALS['ISC_CLASS_DB']->Query($query))) {
				$GLOBALS['CustomerAddressEmptyShow'] = 'none';
			} else {
				$GLOBALS['CustomerAddressEmptyHide'] = 'none';
			}

			$GLOBALS['FormAction'] = "editCustomer2";
			$GLOBALS['CustomerId'] = $customerId;
			$GLOBALS['Title'] = GetLang('EditCustomerTitle');
			$GLOBALS['Intro'] = GetLang('EditCustomerIntro');
			$GLOBALS['CustomerAddressListWarning'] = GetLang('CustomerAddressNoAddresses');
			$GLOBALS['CustomerFirstName'] = $customer['custconfirstname'];
			$GLOBALS['CustomerLastName'] = $customer['custconlastname'];
			$GLOBALS['CustomerCompany'] = $customer['custconcompany'];
			$GLOBALS['CustomerEmail'] = $customer['custconemail'];
			$GLOBALS['CustomerPhone'] = $customer['custconphone'];
			$GLOBALS['CustomerStoreCredit'] = FormatPrice($customer['custstorecredit'], false, false);
			$GLOBALS['CustomerGroupId'] = $customer['custgroupid'];
			$GLOBALS['CustomerGroupOptions'] = $this->GetCustomerGroupsAsOptions($customer['custgroupid']);
			$GLOBALS['CustomerShippingAddressGrid'] = $this->ManageCustomerAddressGrid();
			$GLOBALS['PasswordRequired'] = '&nbsp;&nbsp;';
			$GLOBALS['PasswordLabel'] = GetLang('CustomerNewPassword');
			$GLOBALS['PasswordHelp'] = GetLang('CustomerNewPasswordHelp');
			$GLOBALS['PasswordConfirmHelp'] = GetLang('CustomerNewPasswordConfirmHelp');
			$GLOBALS['PasswordConfirmError'] = GetLang('CustomerNewPasswordConfirmError');
			$GLOBALS['PasswordConfirmRequired'] = '&nbsp;&nbsp;';
			$GLOBALS['CustomFieldsAccountFormId'] = FORMFIELDS_FORM_ACCOUNT;
			$GLOBALS['CustomFields'] = '';

			/**
			 * Custom fields
			 */
			if (gzte11(ISC_MEDIUMPRINT)) {
				if ($PreservePost) {
					$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT, true);
				} else if (isset($customer['custformsessionid']) && isId($customer['custformsessionid'])) {
					$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT, false, $customer['custformsessionid']);
				} else {
					$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT);
				}

				foreach (array_keys($fields) as $fieldId) {
					if ($fields[$fieldId]->record['formfieldprivateid'] !== '') {
						continue;
					}

					$GLOBALS['CustomFields'] .= $fields[$fieldId]->loadForFrontend() . "\n";
				}
			}

			/**
			 * Add this to generate our JS event script
			 */
			$GLOBALS['FormFieldEventData'] = $GLOBALS['ISC_CLASS_FORM']->buildRequiredJS();

			$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
			$GLOBALS['CancelMessage'] = GetLang('ConfirmCancelCustomer');
			$this->template->display('customer.form.tpl');
		}
 /**
  * Admin_Action_Edit
  * This will display the edition/creation page for dynamic content tag
  *
  */
 public function Admin_Action_Edit()
 {
     $ssf = new SendStudio_Functions();
     $id = $this->_getGETRequest('id', 0);
     $userAPI = GetUser();
     $userLists = $userAPI->GetLists();
     $userListsId = array_keys($userLists);
     if (sizeof($userListsId) < 1) {
         $GLOBALS['Intro_Help'] = GetLang('Addon_dynamiccontenttags_Form_Intro');
         $GLOBALS['Intro'] = GetLang('Addon_dynamiccontenttags_Form_CreateHeading');
         $GLOBALS['Lists_AddButton'] = '';
         if ($userAPI->CanCreateList() === true) {
             FlashMessage(sprintf(GetLang('Addon_dynamiccontenttags_Tags_NoLists'), GetLang('Addon_dynamiccontenttags_ListCreate')), SS_FLASH_MSG_SUCCESS);
             $GLOBALS['Message'] = GetFlashMessages();
             $GLOBALS['Lists_AddButton'] = $this->template_system->ParseTemplate('Dynamiccontenttags_List_Create_Button', true);
         } else {
             FlashMessage(sprintf(GetLang('Addon_dynamiccontenttags_Tags_NoLists'), GetLang('Addon_dynamiccontenttags_ListAssign')), SS_FLASH_MSG_SUCCESS);
             $GLOBALS['Message'] = GetFlashMessages();
         }
         $this->template_system->ParseTemplate('Dynamiccontenttags_Subscribers_No_Lists');
         return;
     }
     $listIDs = array();
     $this->template_system->Assign('DynamicContentTagId', intval($id));
     if ($id === 0) {
         $this->template_system->Assign('FormType', 'create');
     } else {
         $this->template_system->Assign('FormType', 'edit');
         // Load the existing Tags.
         $tag = new DynamicContentTag_Api_Tag($id);
         if (!$tag->getTagId()) {
             FlashMessage(GetLang('NoAccess'), SS_FLASH_MSG_ERROR, $this->admin_url);
             return false;
         }
         $tag->loadLists();
         $tag->loadBlocks();
         $listIDs = $tag->getLists();
         $blocks = $tag->getBlocks();
         $blocksString = '';
         foreach ($blocks as $blockEntry) {
             $rule = $blockEntry->getRules();
             $rule = str_replace(array('\\"', "'"), array('\\\\"', '&#39;'), $rule);
             $blocksString .= " BlockInterface.Add(" . intval($blockEntry->getBlockId()) . ", '" . $blockEntry->getName() . "', " . intval($blockEntry->isActivated()) . ", " . intval($blockEntry->getSortOrder()) . ", '" . $rule . "'); ";
         }
         $this->template_system->Assign('dynamiccontenttags_name', $tag->getName());
         $this->template_system->Assign('dynamiccontenttags_blocks', $blocksString);
     }
     $tempList = $userAPI->GetLists();
     $tempSelectList = '';
     foreach ($tempList as $tempEach) {
         $tempSubscriberCount = intval($tempEach['subscribecount']);
         $GLOBALS['ListID'] = intval($tempEach['listid']);
         $GLOBALS['ListName'] = htmlspecialchars($tempEach['name'], ENT_QUOTES, SENDSTUDIO_CHARSET);
         $GLOBALS['OtherProperties'] = in_array($GLOBALS['ListID'], $listIDs) ? ' selected="selected"' : '';
         if ($tempSubscriberCount == 1) {
             $GLOBALS['ListSubscriberCount'] = GetLang('Addon_dynamiccontenttags_Subscriber_Count_One');
         } else {
             $GLOBALS['ListSubscriberCount'] = sprintf(GetLang('Addon_dynamiccontenttags_Subscriber_Count_Many'), $ssf->FormatNumber($tempSubscriberCount));
         }
         $tempSelectList .= $this->template_system->ParseTemplate('DynamicContentTags_Form_ListRow', true);
         unset($GLOBALS['OtherProperties']);
         unset($GLOBALS['ListSubscriberCount']);
         unset($GLOBALS['ListName']);
         unset($GLOBALS['ListID']);
     }
     // If list is less than 10, use the following formula: list size * 25px for the height
     $tempCount = count($tempList);
     if ($tempCount <= 10) {
         if ($tempCount < 3) {
             $tempCount = 3;
         }
         $selectListStyle = 'height: ' . $tempCount * 25 . 'px;';
         $this->template_system->Assign('SelectListStyle', $selectListStyle);
     }
     $flash_messages = GetFlashMessages();
     $this->template_system->Assign('FlashMessages', $flash_messages, false);
     $this->template_system->Assign('AdminUrl', $this->admin_url, false);
     $this->template_system->Assign('SelectListHTML', $tempSelectList);
     $this->template_system->ParseTemplate('dynamiccontenttags_form');
 }
Пример #6
0
 /**
  * Show_Send_Step_10
  * This is the page that gets shown when a user clicks "pause" in the split test send popup window.
  *
  * It marks the job as "paused" in the database
  * then shows an appropriate message.
  *
  * @uses GetApi
  * @uses Splittest_Send_API::PauseJob
  */
 public function Show_Send_Step_10()
 {
     $send_details = IEM::sessionGet('SplitTestSendDetails');
     if (!$send_details || !isset($send_details['splitid']) || (int) $send_details['splitid'] <= 0) {
         FlashMessage(GetLang('Addon_splittest_Send_InvalidSplitTest'), SS_FLASH_MSG_ERROR, $this->admin_url);
         return;
     }
     $job = (int) $send_details['Job'];
     /**
      * Pause it in the split test.
      * This makes it easier to work out a send's "state" (paused, in progress etc).
      */
     $send_api = $this->GetApi('Splittest_Send');
     $paused = $send_api->PauseJob($job, $send_details['splitid']);
     if ($paused) {
         FlashMessage(GetLang('Addon_splittest_Send_Paused_Success'), SS_FLASH_MSG_SUCCESS);
     } else {
         FlashMessage(GetLang('Addon_splittest_Send_Paused_Failure'), SS_FLASH_MSG_ERROR);
     }
     $flash_messages = GetFlashMessages();
     $this->template_system->Assign('FlashMessages', $flash_messages, false);
     $this->template_system->Assign('AdminUrl', $this->admin_url);
     $this->template_system->ParseTemplate('send_paused');
 }
Пример #7
0
 private function ManageOrders($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['HideClearResults'] = "none";
     $status = array();
     $num_custom_searches = 0;
     $numOrders = 0;
     // Fetch any results, place them in the data grid
     $GLOBALS['OrderDataGrid'] = $this->ManageOrdersGrid($numOrders);
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['OrderDataGrid'];
         return;
     }
     if (isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
         $GLOBALS['HideClearResults'] = "";
     }
     if (isset($this->_customSearch['searchname'])) {
         $GLOBALS['ViewName'] = $this->_customSearch['searchname'];
     } else {
         $GLOBALS['ViewName'] = GetLang('AllOrders');
         $GLOBALS['HideDeleteViewLink'] = "none";
     }
     // Do we display the add order buton?
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Add_Orders)) {
         $GLOBALS['AddOrderButton'] = '<input type="button" value="' . GetLang('AddAnOrder') . '..." class="FormButton" style="width:100px" onclick="document.location.href=\'index.php?ToDo=addOrder\'" /><br /><br />';
     } else {
         $GLOBALS['AddOrderButton'] = '';
     }
     $GLOBALS['OrderActionOptions'] = '<option selected="1">' . GetLang('ChooseAction') . '</option>';
     // Do we need to disable the delete button?
     if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Delete_Orders) || $numOrders == 0) {
         $args = 'disabled="1"';
     } else {
         $args = 'value="delete"';
     }
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . GetLang('DeleteSelected') . '</option>';
     if ($numOrders > 0) {
         if ($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || isset($_GET['searchId']) || count($_GET) > 1)) {
             if ($numOrders == 1) {
                 $MsgDesc = GetLang('OrderSearchResultsBelow1');
             } else {
                 $MsgDesc = sprintf(GetLang('OrderSearchResultsBelowX'), $numOrders);
             }
             $MsgStatus = MSG_SUCCESS;
         }
         $args1 = 'value="printInvoice"';
         $args2 = 'value="printSlip"';
     } else {
         $args1 = 'disabled="1"';
         $args2 = 'disabled="1"';
     }
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args1 . '>' . GetLang('PrintInvoicesSelected') . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option ' . $args2 . '>' . GetLang('PrintPackingSlipsSelected') . '</option>';
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
     } else {
         // Do we need to disable the export button?
         if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Export_Orders) || $numOrders == 0) {
             $args = 'disabled="1"';
         } else {
             $args = 'value="export"';
         }
         $GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . GetLang('ExportOrders') . '</option>';
         //$GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . 'Send Review Request' . '</option>';
     }
     //zfang
     //$GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . 'Send Review Request' . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option value="sendOrdReviewReq">' . GetLang('SendReviewRequest') . '</option>';
     $GLOBALS['OrderActionOptions'] .= '<option disabled="1"></option><optgroup label="' . GetLang('BulkOrderStatus') . '">';
     $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_status where statusid!=0 ORDER BY statusorder ASC");
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         $GLOBALS['OrderActionOptions'] .= '<option value="updateStatus' . $row['statusid'] . '">' . $row['statusdesc'] . '</option>';
     }
     $GLOBALS['OrderActionOptions'] .= '</optgroup>';
     if (!isset($_REQUEST['searchId'])) {
         $_REQUEST['searchId'] = 0;
     }
     // Get the custom search as option fields
     $GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions($_REQUEST['searchId'], $num_custom_searches, "AllOrders", "viewOrders", "customOrderSearch");
     if (!isset($_REQUEST['searchId'])) {
         $GLOBALS['HideDeleteCustomSearch'] = "none";
     } else {
         $GLOBALS['CustomSearchId'] = (int) $_REQUEST['searchId'];
     }
     $GLOBALS['OrderIntro'] = GetLang('ManageOrdersIntro');
     $GLOBALS['Message'] = '';
     // No orders
     if ($numOrders == 0) {
         $GLOBALS['DisplayGrid'] = "none";
         // Performing a search of some kind
         if (count($_GET) > 1) {
             if ($MsgDesc == "") {
                 $GLOBALS['Message'] = MessageBox(GetLang('NoOrderResults'), MSG_ERROR);
             }
         } else {
             $GLOBALS['Message'] = MessageBox(GetLang('NoOrders'), MSG_SUCCESS);
             $GLOBALS['DisplaySearch'] = "none";
         }
     }
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages)) {
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     $GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=orders";
     if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
         $GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
     } else {
         $query_params = explode('&', $_SERVER['QUERY_STRING']);
         $params = array();
         $ignore = array("ToDo");
         foreach ($query_params as $param) {
             $arr = explode("=", $param);
             if (!in_arrayi($arr[0], $ignore)) {
                 $params[$arr[0]] = $arr[1];
             }
         }
         if (count($params)) {
             $GLOBALS['ExportAction'] .= "&" . http_build_query($params);
         }
     }
     // Used for iPhone interface
     $GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions();
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("orders.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     echo $GLOBALS['ISC_CLASS_DB']->GetErrorMsg();
 }
Пример #8
0
function del_user_dir($edogyt44 = 0)
{
	$vomawoh8 = (create_user_dir(0, 2) === true);
	if (!$vomawoh8) {
		GetFlashMessages();
	}
	if (!is_array($edogyt44) && $edogyt44 > 0) {
		remove_directory(TEMP_DIRECTORY . "/user/" . $edogyt44);
	}
	return true;
}
Пример #9
0
 public function ManageLayouts($MsgDesc = "", $MsgStatus = "", $template = "")
 {
     $output = '';
     if (isset($_REQUEST['ForceTab'])) {
         $GLOBALS['ForceTab'] = (int) $_REQUEST['ForceTab'];
     }
     if (isset($_REQUEST['forceTab'])) {
         $GLOBALS['ForceTab'] = (int) $_REQUEST['forceTab'];
     }
     $opener = new connect_remote();
     if ($opener->CanOpen()) {
         $GLOBALS['FopenSupport'] = true;
     } else {
         $GLOBALS['FopenSupport'] = false;
     }
     $GLOBALS['CurrentTemplateName'] = GetConfig('template');
     $GLOBALS['CurrentTemplateNameProper'] = ucfirst(GetConfig('template'));
     $GLOBALS['CurrentTemplateColor'] = GetConfig('SiteColor');
     $GLOBALS['StoreLogo'] = GetConfig('StoreLogo');
     $GLOBALS['siteName'] = GetConfig('StoreName');
     $this->LoadChooseTemplateTab();
     $this->LoadDownloadTemplates();
     $this->LoadLogoTab();
     if (file_exists(ISC_BASE_PATH . '/templates/' . GetConfig('template') . '/config.php')) {
         include ISC_BASE_PATH . '/templates/' . GetConfig('template') . '/config.php';
         if (isset($GLOBALS['TPL_CFG']['GenerateLogo']) && $GLOBALS['TPL_CFG']['GenerateLogo'] === true) {
             $GLOBALS['CurrentTemplateHasLogoOption'] = 'true';
         } else {
             $GLOBALS['CurrentTemplateHasLogoOption'] = 'false';
         }
     }
     if (GetConfig('DisableTemplateDownloading')) {
         $GLOBALS['HideDownloadTab'] = 'none';
     }
     $GLOBALS['TemplateVersion'] = '1.0';
     if (isset($GLOBALS['TPL_CFG']['Version'])) {
         $GLOBALS['TemplateVersion'] = $GLOBALS['TPL_CFG']['Version'];
     }
     $GLOBALS['LayoutIntro'] = GetLang('TemplateIntro');
     if (GetConfig('TemplatesOrderCustomURL') == '') {
         $GLOBALS['HideOrderCustomTemplate'] = "none";
     }
     if (GetConfig('DesignMode')) {
         $GLOBALS['DesignModeChecked'] = "checked";
     }
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages)) {
         $GLOBALS['Message'] = '';
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     if (!function_exists("gzdeflate")) {
         // No zlib - they can't download templates automatically
         $GLOBALS['HideDownloadMessage'] = "none";
         $GLOBALS['NoZLibMessage'] = MessageBox(GetLang('NoZLibInstalled'), MSG_ERROR);
     } else {
         // They have zlib - hide the zlib error message
         $GLOBALS['HideNoZLib'] = "none";
     }
     if (!$this->safeMode) {
         $GLOBALS['HideSafeModeMessage'] = 'display: none';
     }
     // Load the email templates
     $GLOBALS['EmailTemplatesGrid'] = $this->_LoadEmailTemplates();
     $GLOBALS['TemplatesOrderCustomURL'] = GetConfig('TemplatesOrderCustomURL');
     // Load a temporary editor to use for editing email templates
     $wysiwygOptions = array('id' => 'temp_email_editor', 'delayLoad' => true);
     $GLOBALS['TemporaryEditor'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("layout.manage");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Пример #10
0
	/**
	 * Process
	 * This handles working out what stage you are up to and so on with workflow.
	 * @return Void Does not return anything
	 *
	 * @uses GetUser()
	 * @uses User_API::HasAccess()
	 * @uses SendStudio_Functions::PrintHeader()
	 * @uses SendStudio_Functions::DenyAccess()
	 * @uses SendStudio_Functions::PrintFooter()
	 * @uses SendStudio_Functions::_getGETRequest()
	 * @uses TriggerEmails::_ajax()
	 * @uses TriggerEmails::_create()
	 * @uses TriggerEmails::_edit()
	 * @uses TriggerEmails::_copy()
	 * @uses TriggerEmails::_enable()
	 * @uses TriggerEmails::_disable()
	 * @uses TriggerEmails::_save()
	 * @uses TriggerEmails::_delete()
	 * @uses TriggerEmails::_bulkAction()
	 * @uses TriggerEmails::_manage()
	 */
	public function Process()
	{
		// ----- Define and sanitize "common" variables that is used by this function
			$user = GetUser();

			$reqAction		= IEM::requestGetGET('Action', '', 'strtolower');
			$response		= '';
			$parameters 	= array();

			$parameters['message']	= GetFlashMessages();
			$parameters['user']		= GetUser();
			$parameters['action']	= $reqAction;
		// ------


		// ----- Check basic permission
			$access = $user->HasAccess('triggeremails') && check('Triggermails');
			if (!$access) {
				$this->PrintHeader();
				$this->DenyAccess();
				$this->PrintFooter();
				return;
			}
		// ------

		if (!SENDSTUDIO_CRON_ENABLED || SENDSTUDIO_CRON_TRIGGEREMAILS_S <= 0 || SENDSTUDIO_CRON_TRIGGEREMAILS_P <= 0) {
			$parameters['message'] .= $this->PrintWarning('TriggerEmails_Manage_CRON_Alert');
		}

		switch ($reqAction) {
			// AJAX request
			case 'ajax':
				$response = $this->_ajax($parameters);
			break;

			// Show "create" form
			case 'create':
				$response = $this->_create($parameters);
			break;

			// Show "edit" form
			case 'edit':
				$response = $this->_edit($parameters);
			break;

			// Copy trigger record
			case 'copy':
				$response = $this->_copy($parameters);
			break;

			// Enable record
			case 'enable':
				$response = $this->_enable($parameters);
			break;

			// Disable record
			case 'disable':
				$response = $this->_disable($parameters);
			break;

			// Save trigger record (from "create"/"edit" form)
			case 'save':
				$response = $this->_save($parameters);
			break;

			// Delete trigger record
			case 'delete':
				$response = $this->_delete($parameters);
			break;

			// Handle bulk action
			case 'bulkaction':
				$response = $this->_bulkAction($parameters);
			break;

			case 'processpaging':
			default:
				$response = $this->_manage($parameters);
			break;
		}


		// ----- Print output
			$ajax = ($reqAction == 'ajax');

			if (!$ajax) {
				$this->PrintHeader();
			} else {
				header('Content-type: application/json');
			}

			echo $response;

			if (!$ajax) {
				$this->PrintFooter();
			}
		// -----
	}
Пример #11
0
		public function AddProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost=false)
		{
			if($message = strtokenize($_REQUEST, '#')) {
				$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoError(GetLang(B('UmVhY2hlZFByb2R1Y3RMaW1pdA==')), $message, MSG_ERROR);
				exit;
			}

			$defaultProduct = array(
				'tax_class_id' => 0,
			);


			if ($MsgDesc != "") {
				$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
			} else {
				$flashMessages = GetFlashMessages();
				if(is_array($flashMessages)) {
					$GLOBALS['Message'] = '';
					foreach($flashMessages as $flashMessage) {
						$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
					}
				}
			}

			// Get the getting started box if we need to
			$GLOBALS['GettingStartedStep'] = '';
			if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) &&  !in_array('products', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
				$GLOBALS['GettingStartedTitle'] = GetLang('WizardAddProducts');
				$GLOBALS['GettingStartedContent'] = GetLang('WizardAddProductsDesc');
				$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
			}

			if (GetConfig('CurrencyLocation') == 'right') {
				$GLOBALS['CurrencyTokenLeft'] = '';
				$GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
			} else {
				$GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
				$GLOBALS['CurrencyTokenRight'] = '';
			}

			// delete any uploaded images which are not attached to a product and older than 24 hours
			ISC_PRODUCT_IMAGE::deleteOrphanedProductImages();

			// Delete any temporary combination records older than 24h
			$this->DeleteTemporaryCombinations();

			// Delete any uploaded product downloads which are not attached to a product and older than 24h
			$query = sprintf("select downloadid, downfile from [|PREFIX|]product_downloads where downdateadded<'%d' and productid=0", time()-86400);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$dlids = array();
			while($download = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				@unlink(APP_ROOT."../".GetConfig('DownloadDirectory')."/".$download['downfile']);
				$dlids[] = $download['downloadid'];
			}
			if(!empty($dlids)) {
				$query = sprintf("delete from [|PREFIX|]product_downloads where downloadid in (%s)", implode(",", $dlids));
				$GLOBALS['ISC_CLASS_DB']->Query($query);
			}

			$GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions();

			$GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');

			if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
				$GLOBALS['HideStoreFeatured'] = 'display: none';
			}
			else if(!gzte11(ISC_HUGEPRINT)) {
				$GLOBALS['HideVendorFeatured'] = 'display: none';
			}


			// Set the global variables for the select boxes
			$from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
			$to_stamp = isc_gmmktime(0, 0, 0, isc_date("m")+1, isc_date("d"), isc_date("Y"));

			$from_day = isc_date("d", $from_stamp);
			$from_month = isc_date("m", $from_stamp);
			$from_year = isc_date("Y", $from_stamp);

			$to_day = isc_date("d", $to_stamp);
			$to_month = isc_date("m", $to_stamp);
			$to_year = isc_date("Y", $to_stamp);

			$GLOBALS['OverviewFromDays'] = $this->_GetDayOptions($from_day);
			$GLOBALS['OverviewFromMonths'] = $this->_GetMonthOptions($from_month);
			$GLOBALS['OverviewFromYears'] = $this->_GetYearOptions($from_year);

			$GLOBALS['OverviewToDays'] = $this->_GetDayOptions($to_day);
			$GLOBALS['OverviewToMonths'] = $this->_GetMonthOptions($to_month);
			$GLOBALS['OverviewToYears'] = $this->_GetYearOptions($to_year);

			$productImages = array();

			if($PreservePost == true) {
				$this->_GetProductData(0, $arrData);
				$this->_GetCustomFieldData(0, $arrCustomFields);
				$this->template->assign('product', $arrData);
				$productImages = $arrData['product_images'];

				$GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"';
				$GLOBALS['ProdType'] = $arrData['prodtype'] - 1;
				$GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']);

				$GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']);

				$visibleCategories = array();
				if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
					$vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
					if($vendorData['vendoraccesscats']) {
						$visibleCategories = explode(',', $vendorData['vendoraccesscats']);
					}
				}

				$GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false, '', $visibleCategories);
				$GLOBALS['RelatedCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "- ", false);

				$wysiwygOptions = array(
					'id'		=> 'wysiwyg',
					'width'		=> '100%',
					'height'	=> '500px',
					'value'		=> $arrData['proddesc']
				);
				$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

				$GLOBALS['ProdSearchKeywords'] = $arrData['prodsearchkeywords'];
				$GLOBALS['ProdAvailability'] = $arrData['prodavailability'];
				$GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");

				if (CFloat($arrData['prodcostprice']) > 0) {
					$GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
				}

				if (CFloat($arrData['prodretailprice']) > 0) {
					$GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
				}

				if (CFloat($arrData['prodsaleprice']) > 0) {
					$GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
				}

				$GLOBALS['ProdSortOrder'] = $arrData['prodsortorder'];

				if ($arrData['prodvisible'] == 1) {
					$GLOBALS['ProdVisible'] = "checked";
				}

				if ($arrData['prodfeatured'] == 1) {
					$GLOBALS['ProdFeatured'] = "checked";
				}

				if($arrData['prodvendorfeatured'] == 1) {
					$GLOBALS['ProdVendorFeatured'] = 'checked="checked"';
				}

				if($arrData['prodallowpurchases'] == 1) {
					$GLOBALS['ProdAllowPurchases'] = 'checked="checked"';
				}
				else {
					if($arrData['prodhideprice'] == 1) {
						$GLOBALS['ProdHidePrice'] = 'checked="checked"';
					}
				}

				$GLOBALS['ProdCallForPricing'] = isc_html_escape(@$arrData['prodCallForPricingLabel']);

				$GLOBALS['ProdWarranty'] = $arrData['prodwarranty'];
				$GLOBALS['ProdWeight'] = number_format($arrData['prodweight'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");

				if (CFloat($arrData['prodwidth']) > 0) {
					$GLOBALS['ProdWidth'] = number_format($arrData['prodwidth'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
				}

				if (CFloat($arrData['prodheight']) > 0) {
					$GLOBALS['ProdHeight'] = number_format($arrData['prodheight'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
				}

				if (CFloat($arrData['proddepth']) > 0) {
					$GLOBALS['ProdDepth'] = number_format($arrData['proddepth'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
				}

				if (CFloat($arrData['prodfixedshippingcost']) > 0) {
					$GLOBALS['ProdFixedShippingCost'] = number_format($arrData['prodfixedshippingcost'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
				}

				if ($arrData['prodfreeshipping'] == 1) {
					$GLOBALS['FreeShipping'] = 'checked="checked"';
				}

				if($arrData['prodrelatedproducts'] == -1) {
					$GLOBALS['IsProdRelatedAuto'] = 'checked="checked"';
				}
				else if(isset($arrData['prodrelated'])) {
					$GLOBALS['RelatedProductOptions'] = "";

					foreach ($arrData['prodrelated'] as $r) {
						$GLOBALS['RelatedProductOptions'] .= sprintf("<option value='%d'>%s</option>", $r[0], $r[1]);
					}
				}

				$GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect(explode(',', $arrData['prodwrapoptions']));
				$GLOBALS['HideGiftWrappingOptions'] = 'display: none';
				if($arrData['prodwrapoptions'] == 0) {
					$GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"';
				}
				else if($arrData['prodwrapoptions'] == -1) {
					$GLOBALS['WrappingOptionsNoneChecked'] = 'checked="checked"';
				}
				else {
					$GLOBALS['HideGiftWrappingOptions'] = '';
					$GLOBALS['WrappingOptionsCustomChecked'] = 'checked="checked"';
				}

				$GLOBALS['CurrentStockLevel'] = $arrData['prodcurrentinv'];
				$GLOBALS['LowStockLevel'] = $arrData['prodlowinv'];
				$GLOBALS["InvTrack_" . $arrData['prodinvtrack']] = 'checked="checked"';

				if ($arrData['prodinvtrack'] == 1) {
					$GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(true);";
				} else {
					$GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);";
				}


				if ($arrData['prodoptionsrequired'] == 1) {
					$GLOBALS['ProdOptionRequired'] = 'checked="checked"';
				}

				if ($arrData['prodtype'] == 1) {
					$GLOBALS['HideProductInventoryOptions'] = "none";
				}

				if(getConfig('taxEnteredWithPrices') == TAX_PRICES_ENTERED_INCLUSIVE) {
					$this->template->assign('enterPricesWithTax', true);
				}

				$GLOBALS['CustomFields'] = '';
				$GLOBALS['CustomFieldKey'] = 0;

				if (!empty($arrCustomFields)) {
					foreach ($arrCustomFields as $f) {
						$GLOBALS['CustomFieldName'] = isc_html_escape($f['name']);
						$GLOBALS['CustomFieldValue'] = isc_html_escape($f['value']);
						$GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel(($GLOBALS['CustomFieldKey']+1), GetLang('CustomField'));

						if (!$GLOBALS['CustomFieldKey']) {
							$GLOBALS['HideCustomFieldDelete'] = 'none';
						} else {
							$GLOBALS['HideCustomFieldDelete'] = '';
						}

						$GLOBALS['CustomFields'] .= $this->template->render('Snippets/CustomFields.html');

						$GLOBALS['CustomFieldKey']++;
					}
				}

				// Add one more custom field
				$GLOBALS['CustomFieldName'] = '';
				$GLOBALS['CustomFieldValue'] = '';
				$GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel(($GLOBALS['CustomFieldKey']+1), GetLang('CustomField'));

				if (!$GLOBALS['CustomFieldKey']) {
					$GLOBALS['HideCustomFieldDelete'] = 'none';
				} else {
					$GLOBALS['HideCustomFieldDelete'] = '';
				}

				$GLOBALS['CustomFields'] .= $this->template->render('Snippets/CustomFields.html');

				// Get the brands as select options
				$GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
				$GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions($arrData['prodbrandid']);

				// Get a list of all layout files
				$layoutFile = 'product.html';
				if($arrData['prodlayoutfile']) {
					$layoutFile = $arrData['prodlayoutfile'];
				}
				$GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html", $layoutFile);

				$GLOBALS['ProdPageTitle'] = $arrData['prodpagetitle'];
				$GLOBALS['ProdMetaKeywords'] = $arrData['prodmetakeywords'];
				$GLOBALS['ProdMetaDesc'] = $arrData['prodmetadesc'];

				if (isset($_REQUEST['productHash'])) {
					// load any previously uploaded images
					$productImages = ISC_PRODUCT_IMAGE::getProductImagesFromDatabase($_REQUEST['productHash'], null, true);
				}

				// Open Graph Settings
				$this->template->assign('openGraphTypes', ISC_OPENGRAPH::getObjectTypes(true));
				$this->template->assign('openGraphSelectedType', $arrData['opengraph_type']);
				$this->template->assign('openGraphUseProductName', (bool)$arrData['opengraph_use_product_name']);
				$this->template->assign('openGraphTitle', $arrData['opengraph_title']);
				$this->template->assign('openGraphUseMetaDescription', (bool)$arrData['opengraph_use_meta_description']);
				$this->template->assign('openGraphDescription', $arrData['opengraph_description']);
				$this->template->assign('openGraphUseImage', (bool)$arrData['opengraph_use_image']);

				// UPC
				$this->template->assign('ProdUPC', $arrData['upc']);

				// Google Checkout
				$this->template->assign('ProdDisableGoogleCheckout', $arrData['disable_google_checkout']);
			}
			else {
				$this->template->assign('product', $defaultProduct);
				$Cats = array();
				$Description = GetLang('TypeProductDescHere');

				$GLOBALS['ProdType'] = 0;
				$GLOBALS["ProdType_1"] = 'checked="checked"';
				$GLOBALS['HideFile'] = "none";

				$visibleCategories = array();
				if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
					$vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
					if($vendorData['vendoraccesscats']) {
						$visibleCategories = explode(',', $vendorData['vendoraccesscats']);
					}
				}
				$GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($Cats, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false, '', $visibleCategories);
				$GLOBALS['RelatedCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($Cats, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "- ", false);

				$wysiwygOptions = array(
					'id'		=> 'wysiwyg',
					'width'		=> '100%',
					'height'	=> '500px',
					'value'		=> $Description
				);
				$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

				$GLOBALS['ProdVisible'] = "checked";
				$GLOBALS['ProdSortOrder'] = 0;
				$GLOBALS["InvTrack_0"] = 'checked="checked"';
				$GLOBALS['HideProductInventoryOptions'] = "none";
				$GLOBALS['CurrentStockLevel'] = 0;
				$GLOBALS['LowStockLevel'] = 0;
				$GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);";
				$GLOBALS['ExistingDownload'] = "false";
				$GLOBALS['IsProdRelatedAuto'] = 'checked="checked"';

				$GLOBALS['ProdAllowPurchases'] = 'checked="checked"';
				$GLOBALS['ProdCallForPricingLabel'] = GetLang('ProductCallForPricingDefault');

				// Get the brands as select options
				$GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
				$GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions();

				$GLOBALS['CustomFieldKey'] = 0;
				$GLOBALS['CustomFieldName'] = '';
				$GLOBALS['CustomFieldValue'] = '';
				$GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel(($GLOBALS['CustomFieldKey']+1), GetLang('CustomField'));
				$GLOBALS['HideCustomFieldDelete'] = 'none';
				$GLOBALS['CustomFields'] = $this->template->render('Snippets/CustomFields.html');

				$GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect();
				$GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"';

				// Open Graph Settings
				$this->template->assign('openGraphTypes', ISC_OPENGRAPH::getObjectTypes(true));
				$this->template->assign('openGraphSelectedType', 'product');
				$this->template->assign('openGraphUseProductName', true);
				$this->template->assign('openGraphUseMetaDescription', true);
				$this->template->assign('openGraphUseImage', true);
			}

			// Get the list of tax classes and assign them
			$this->template->assign('taxClasses', array(
				0 => getLang('DefaultTaxClass')
			) + getClass('ISC_TAX')->getTaxClasses());

			$this->setupProductImageGlobals($productImages);

			$GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0);

			if(!gzte11(ISC_HUGEPRINT)) {
				$GLOBALS['HideVendorOption'] = 'display: none';
			}
			else {
				$vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
				if(isset($vendorData['vendorid'])) {
					$GLOBALS['HideVendorSelect'] = 'display: none';
					$GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']);
				}
				else {
					$GLOBALS['HideVendorLabel'] = 'display: none';
					if($PreservePost) {
						$GLOBALS['VendorList'] = $this->BuildVendorSelect($_POST['vendor']);
					}
					else {
						$GLOBALS['VendorList'] = $this->BuildVendorSelect();
					}
				}
			}

			// Does this store have any categories?
			if (!$this->db->FetchOne("SELECT COUNT(*) FROM [|PREFIX|]categories")) {
				$GLOBALS['NoCategoriesJS'] = 'true';
			}

			$GLOBALS['FormType'] = "AddingProduct";
			$GLOBALS['FormAction'] = "addProduct2";
			$GLOBALS['Title'] = GetLang('AddProductTitle');
			$GLOBALS['Intro'] = GetLang('AddProductIntro');
			$GLOBALS['CurrentTab'] = 0;

			if(getConfig('taxEnteredWithPrices') == TAX_PRICES_ENTERED_INCLUSIVE) {
				$this->template->assign('enterPricesWithTax', true);
			}

			if(!gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS['HideInventoryOptions'] = "none";
			}
			else {
				$GLOBALS['HideInventoryOptions'] = '';
			}

			$GLOBALS['ISC_LANG']['MaxUploadSize'] = sprintf(GetLang('MaxUploadSize'), GetMaxUploadSize());
			if(isset($_REQUEST['productHash'])) {
				// Get a list of any downloads associated with this product
				$GLOBALS['DownloadsGrid'] = $this->GetDownloadsGrid(0, $_REQUEST['productHash']);
				if($GLOBALS['DownloadsGrid'] == '') {
					$GLOBALS['DisplayDownloaadGrid'] = "none";
					$GLOBALS['DisplayDownloadUploadGap'] = 'none';
				}
				$GLOBALS['ProductHash'] = $_REQUEST['productHash'];
			}
			else {
				$GLOBALS['DisplayDownloaadGrid'] = "none";
				$GLOBALS['DisplayDownloadUploadGap'] = 'none';
				$GLOBALS['ProductHash'] = md5(time().uniqid(rand(), true));
			}

			// Get a list of all layout files
			$GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html");

			// By default we have no variation selected
			$GLOBALS['IsNoVariation'] = 'checked="checked"';
			$GLOBALS['HideVariationList'] = "none";

			// If there are no variations then disable the option to choose one
			$numVariations = 0;
			$GLOBALS['VariationOptions'] = $this->GetVariationsAsOptions($numVariations);

			if($numVariations == 0) {
				$GLOBALS['VariationDisabled'] = "DISABLED";
				$GLOBALS['VariationColor'] = "#CACACA";
			}

			// By default we set variations to NO
			$GLOBALS['IsNoVariation'] = 'checked="checked"';

			// By default we set product options required to YES
			$GLOBALS['OptionsRequired'] = 'checked="checked"';

			// Display the discount rules
			$GLOBALS['DiscountRules'] = $this->GetDiscountRules(0);

			$GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault');

			// Hide if we are not enabled
			if (!GetConfig('BulkDiscountEnabled')) {
				$GLOBALS['HideDiscountRulesWarningBox'] = '';
				$GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning');
				$GLOBALS['DiscountRulesWithWarning'] = 'none';

			// Also hide it if this product has variations
			} else if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) {
				$GLOBALS['HideDiscountRulesWarningBox'] = '';
				$GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning');
				$GLOBALS['DiscountRulesWithWarning'] = 'none';
			} else {
				$GLOBALS['HideDiscountRulesWarningBox'] = 'none';
				$GLOBALS['DiscountRulesWithWarning'] = '';
			}

			$GLOBALS['DiscountRulesEnabled'] = (int)GetConfig('BulkDiscountEnabled');

			if(!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Create_Category)) {
				$GLOBALS['HideCategoryCreation'] = 'display: none';
			}

			//Google website optimizer
			$GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('EnableGoogleWebsiteOptimizerAfterSave');
			$GLOBALS['ShowEnableGoogleWebsiteOptimzer'] = 'display:none';
			$GLOBALS['DisableOptimizerCheckbox'] = 'DISABLED=DISABLED';
			$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother');

			// set the shopping comparison view vars
			$this->setupProductLanguageString();
			$this->template->assign('shoppingComparisonModules', $this->getComparisonOptions());
			$this->template->assign('_prodorderable', 'yes');
			$this->template->assign('prodpreordermessage', GetConfig('DefaultPreOrderMessage'));
			$this->template->display('product.form.tpl');
		}
Пример #12
0
	/**
	 * Process
	 * Sets up the main page. Checks access levels and so on before printing out each option. Once the areas are set up, it simply calls the parent process function to do everything.
	 *
	 * @see GetUser
	 * @see User_API::HasAccess
	 * @see SendStudio_Functions::Process
	 *
	 * @return Void Prints out the main page, doesn't return anything.
	 */
	function Process()
	{
		$user = GetUser();

		$action = '';
		if (isset($_GET['Action'])) {
			$action = strtolower($_GET['Action']);
		}

		$print_header = true;

		/*
		 * If it's an ajax action, don't print the header.
		 * This also affects the footer at the bottom.
		 */
		$ajax_actions = array('switch', 'subscribergraph', 'cleanupexport', 'hidethis', 'getcampaignlist', 'campaignview', 'getcampaigndropdown', 'getcampaignchart', 'getrecentlists', 'getpredefinedlinklist');
		if (in_array($action, $ajax_actions)) {
			$print_header = false;
		}

		if ($print_header) {
			$this->PrintHeader();
		}

		switch ($action) {
			case 'switch':
				if (isset($_POST['To']) && strtolower($_POST['To']) == 'quicklinks') {
					$user->SetSettings('StartLinks', 'quicklinks');
					break;
				}
				$user->SetSettings('StartLinks', 'gettingstarted');
				break;

			case 'campaignview':
				if (isset($_POST['To'])) {
					switch (strtolower($_POST['To'])) {
						case 'campaignshowschedule':
							$user->SetSettings('CampaignLinks', 'campaignshowschedule');
							break;
						case 'campaignshowsent':
							$user->SetSettings('CampaignLinks', 'campaignshowsent');
							break;
						case 'campaignshowarchive':
							$user->SetSettings('CampaignLinks', 'campaignshowarchive');
							break;
						default:
							$user->SetSettings('CampaignLinks', 'campaignshowall');
					}
				}
				break;

			case 'hidethis':
				if (isset($_POST['To']) && strtolower($_POST['To']) == 'none') {
					$user->SetSettings('ShowThis', 'none');
					break;
				}
				$user->SetSettings('ShowThis', 'block');
				break;

			case 'getcampaigndropdown':
				$this->PrintCampaignsDropdown();
				break;

			case 'getrecentlists':
				$this->PrintRecentLists();
				break;

			case 'getcampaignchart':
				$statsapi = $this->GetApi('Stats');
				if (isset($_POST['StatId'])) {
					$this->PrintCampaignsChart($_POST['StatId']);
					$user->SetSettings('CampaignChart', $_POST['StatId']);
					break;
				}

				break;
			case 'getcampaignlist':
				if (isset($_POST['To'])) {
					if ($_POST['To'] == 'campaignshowschedule') {
						$this->PrintJobs();
					} else {
						$this->PrintCampaign($_POST['To']);
					}
					break;
				}
				break;

			case 'subscribergraph':
				$this->PrintGraph();
				break;

			case 'cleanupexport':
				$this->CleanupExportFile();
				break;

			case 'getpredefinedlinklist':
				$this->GetPredefinedLinkList();
				break;

			default:
				$db = IEM::getDatabase();
				$GLOBALS['Message'] = GetFlashMessages();

				if ($user->GetSettings('StartLinks') == 'quicklinks') {
					$GLOBALS['HomeGettingStartedDisplay'] = 'display:none;';
					$GLOBALS['StartTitle'] = GetLang('IWouldLikeTo');
					$GLOBALS['SwitchLink'] = GetLang('SwitchtoGettingStartedLinks');
				} else {
					$GLOBALS['HomeQuickLinksDisplay'] = 'display:none;';
					$GLOBALS['StartTitle'] = GetLang('GettingStarted_Header');
					$GLOBALS['SwitchLink'] = GetLang('SwitchtoQuickLinks');
				}

				$GLOBALS['HideThisDisplay'] = 'display:block;';
				$GLOBALS['HideThisText'] = GetLang('GettingStarted_HideThis');
				if ($user->GetSettings('ShowThis') == 'none') {
					$GLOBALS['HideThisDisplay'] = 'display:none;';
					$GLOBALS['HideThisText'] = GetLang('GettingStarted_ShowMore');
				}

				$GLOBALS['CampaignSelectedLink'] = $user->GetSettings('CampaignLinks');
				if (!$GLOBALS['CampaignSelectedLink']) {
					$GLOBALS['CampaignSelectedLink'] = 'campaignshowall';
				}

				$GLOBALS['CampaignSelectedChart'] = $user->GetSettings('CampaignChart');
				if (!$GLOBALS['CampaignSelectedChart']) {
					$GLOBALS['CampaignSelectedChart'] = 0;
				}

				$GLOBALS['VersionCheckInfo'] = $this->_CheckVersion();

				$GLOBALS['DisplayBox'] = GetDisplayInfo($this, false, null);

				$this->PrintSystemMessage();

				$GLOBALS['DisplayListButton'] = 'none';
				if ($this->PrintRecentLists(true)) {
					$GLOBALS['DisplayListButton'] = 'block';
				}

				$tpl = GetTemplateSystem();
				$tpl->Assign('showintrovideo', !!constant('SHOW_INTRO_VIDEO'));
				$tpl->ParseTemplate('index');
		}

		if ($print_header) {
			$this->PrintFooter();
		}
	}
Пример #13
0
 /**
  * Edit page
  *
  * Method will construct the edit page
  *
  * @access public
  * @param string $MsgDesc The optional message to display
  * @param string $MsgStatus The optional status of the message
  * @param bool $PreservePost TRUE to use the REQUEST variable, FALSE to read from the database. Default is FALSE
  * @return Void
  */
 public function EditAddonProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost = false)
 {
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $flashMessages = GetFlashMessages();
     if (is_array($flashMessages) && !empty($flashMessages)) {
         $GLOBALS['Message'] = '';
         foreach ($flashMessages as $flashMessage) {
             $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
         }
     }
     // Show the form to edit
     $addonProductId = (int) $_GET['addonProductId'];
     // Make sure it exists
     if (!AddonProductExists($addonProductId)) {
         // doesn't exist
         if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Addon_Products)) {
             $this->ManageAddonProducts(GetLang('AddonProductDoesntExist'), MSG_ERROR);
         } else {
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
         }
         return;
     }
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['CurrencyTokenLeft'] = '';
         $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
         $GLOBALS['CurrencyTokenRight'] = '';
     }
     if ($PreservePost == true) {
         $addonProduct = $this->_GetAddonProductData(0);
     } else {
         $addonProduct = $this->_GetAddonProductData($addonProductId);
     }
     if (isset($_REQUEST['currentTab'])) {
         $GLOBALS['CurrentTab'] = (int) $_REQUEST['currentTab'];
     } else {
         $GLOBALS['CurrentTab'] = 0;
     }
     $GLOBALS['FormAction'] = "editaddonproduct2";
     $GLOBALS['AddonProductId'] = $addonProductId;
     $GLOBALS['Title'] = GetLang('EditAddonProduct');
     $GLOBALS['Intro'] = GetLang('EditAddonProductsIntro');
     $GLOBALS['AddonProductProductId'] = $addonProduct['productid'];
     $GLOBALS['AddonProductProductName'] = $addonProduct['productname'];
     $GLOBALS['AddonProductPrice'] = FormatPrice($addonProduct['price'], false, false);
     $GLOBALS['AddonProductDescription'] = $addonProduct['description'];
     $addonProduct['status'] == 0 ? $GLOBALS['AddonProductStatusDisabled'] = 'selected="selected"' : ($GLOBALS['AddonProductStatusEnabled'] = 'selected="selected"');
     $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
     $GLOBALS['CancelMessage'] = GetLang('ConfirmCancelAddonProduct');
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("addonproduct.form");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Пример #14
0
		/**
		 * TriggerEmailsStats_View
		 * Handle listing of the trigger emails statistics
		 *
		 * @return Void Prints output directly to stdout without returning anything.
		 *
		 * @uses Stats_API::GetTriggerEmailsStats()
		 */
		function TriggerEmailsStats_View()
		{
			// ----- Sanitize and declare variables that is going to be used in this function
				$user = IEM::userGetCurrent();

				$id					= intval($this->_getGETRequest('id', ''));

				$record				= array();
				$triggerrecord		= array();

				$api				= $this->GetApi();
				$triggerapi			= $this->GetApi('TriggerEmails');

				$page = array(
					'messages'		=> GetFlashMessages(),
					'whichtab'		=> intval($this->_getGETRequest('tab', 1)),
					'unique_open'	=> ($this->_getGETRequest('Unique', false) ? true : false),
					'session_token'	=> md5(uniqid(rand()))
				);

				$tabs				= array(
					'snapshot'		=> array(),
					'open'			=> array(),
					'links'			=> array(),
					'bounces'		=> array(),
					'unsubscribe'	=> array(),
					'forward'		=> array(),
					'recipients'	=> array()
				);

			// ----

			if ($id == 0) {
				return $this->TriggerEmailsStats_List();
			}

			// Make sure that user can access this particular trigger email statistics
			if (!$this->_TriggerEmailsStats_Access($id)) {
				return $this->TriggerEmailsStats_List();
			}

			// ----- Load trigger emails statistics record
				$record = $api->GetTriggerEmailsStatsRecord($id);
				$triggerrecord = $triggerapi->GetRecordByID($id, true, true);

				if (!isset($triggerrecord['triggeractions']) || !is_array($triggerrecord['triggeractions'])) {
					$triggerrecord['triggeractions'] = array();
				}

				if (!isset($triggerrecord['triggeractions']['send']) || !is_array($triggerrecord['triggeractions']['send'])) {
					$triggerrecord['triggeractions']['send'] = array();
				}

				$temp = array('trackopens', 'tracklinks');
				foreach ($temp as $each) {
					if (!isset($triggerrecord['triggeractions']['send'][$each])) {
						$triggerrecord['triggeractions']['send'][$each] = 0;
					}
				}

				if (empty($record)) {
					return $this->TriggerEmailsStats_List();
				}
			// -----


			// Log this to "User Activity Log"
			IEM::logUserActivity($_SERVER['REQUEST_URI'], 'images/chart_bar.gif', $record['triggeremailsname']);

			// ----- Calculate some common variables for the record
				$record['processed_totalsent'] = intval($record['htmlrecipients']) + intval($record['textrecipients']) + intval($record['multipartrecipients']);
				$record['processed_unopened'] = abs($record['processed_totalsent'] - $record['emailopens_unique']);
				$record['processed_totalbounced'] = intval($record['bouncecount_soft']) + intval($record['bouncecount_hard']) + intval($record['bouncecount_unknown']);

				if ($record['processed_totalsent'] != 0) {
					if ($triggerrecord['triggeractions']['send']['trackopens'] != 0) {
						$record['processed_timeframe_emailopens_total'] = intval($api->GetOpens($record['statid'], 1, 'all', $page['unique_open'], $this->CalendarRestrictions['opens'], true));
						$record['processed_timeframe_emailopens_unique'] = intval($api->GetOpens($record['statid'], 1, 'all', $page['unique_open'], $this->CalendarRestrictions['opens'], true));
					}

					if ($triggerrecord['triggeractions']['send']['tracklinks'] != 0) {
						$record['processed_timeframe_linkclicks_total'] = intval($api->GetClicks($record['statid'], 1, 'all', 'a', $this->CalendarRestrictions['clicks'], true));
						$record['processed_timeframe_linkclicks_unique'] = intval($api->GetUniqueClicks($record['statid'], 'a', $this->CalendarRestrictions['clicks']));
						$record['processed_timeframe_linkclicks_individuals'] = intval($api->GetUniqueClickRecipients($record['statid'], $this->CalendarRestrictions['clicks'], 'a'));
					}

					$record['processed_timeframe_bounces'] = intval($api->GetBounces($record['statid'], 1, 'all', 'any', $this->CalendarRestrictions['bounces'], true));

					$record['processed_timeframe_unsubscribes'] = intval($api->GetUnsubscribes($record['statid'], 1, 'all', $this->CalendarRestrictions['unsubscribes'], true));

					if (array_key_exists('forwards', $this->CalendarRestrictions) && !empty($this->CalendarRestrictions['forwards'])) {
						$record['processed_timeframe_forwards'] = intval($api->GetForwards($record['statid'], 1, 'all', $this->CalendarRestrictions['forwards'], true));
					} else {
						$record['processed_timeframe_forwards']	= intval($record['emailforwards']);
					}

					$record['processed_timeframe_totalsent'] = 0;

					// Set up session information that correspond to the current stats (this information in the session will not be cleaned up, need to refactor)
					// The session infromation is used to print out a table that list email addressess for "open" and "link" tabs
					IEM::sessionSet($page['session_token'], array(
						'statid'				=> $record['statid'],
						'calendar_restrictions'	=> $this->CalendarRestrictions,
						'unique_open_only'		=> $page['unique_open'],
						'summary'				=> $record
					));
				}
			// -----





			// Load additional language variable for displaying trigger email statistics
			$this->LoadLanguageFile('TriggerEmails');

			// Include the charting tool
			include_once (SENDSTUDIO_FUNCTION_DIRECTORY . '/amcharts/amcharts.php');


			// ----- Tab 1: Snapshot
				$tabs['snapshot']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Snapshots_Intro'), $record['triggeremailsname']);
				$tabs['snapshot']['newsletter_uniqueopen'] = sprintf(GetLang('EmailOpens_Unique'), $this->FormatNumber($record['emailopens_unique']));
				$tabs['snapshot']['newsletter_totalopen'] = sprintf(GetLang('EmailOpens_Total'), $this->FormatNumber($record['emailopens']));
				$tabs['snapshot']['newsletter_bounce'] = $this->FormatNumber($record['processed_totalbounced']);
				$tabs['snapshot']['url_open_url'] = 'index.php?Page=Stats&Action=TriggerEmails&SubAction=view&tab=2&id=' . $id;
				$tabs['snapshot']['url_openunique_url'] = $tabs['snapshot']['url_open_url'] . '&Unique=1';

				$tabs['snapshot']['summary_chart'] = InsertChart(
					'pie',
					'stats_chart.php?Opens=' . $record['emailopens_unique'] . '&Unopened=' . $record['processed_unopened'] . '&Bounced=' . $record['processed_totalbounced'] . '&Area=TriggerEmails&'. IEM::SESSION_NAME . '=' . IEM::sessionID(),
					array('graph_title' => sprintf(GetLang('TriggerEmails_Stats_Snapshots_ChartTitle'), $record['triggeremailsname'])));
			// -----

			// ----- Tab 2: Open rates
				$tabs['open']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Open_Intro'), $record['triggeremailsname']);

				// setup calendar
				$GLOBALS['TabID'] = '1';
				$this->SetupCalendar('Action=ProcessCalendar&SubAction=TriggerEmails&NextAction=View&tab=2&id=' . $id);
				$tabs['open']['calendar'] = $GLOBALS['Calendar'];
				unset($GLOBALS['TabID']);
				unset($GLOBALS['Calendar']);


				// Set up error message if no "opens" count is not available
				if (!array_key_exists('processed_timeframe_emailopens_total', $record) || !$record['processed_timeframe_emailopens_total']) {
					$tempMessage = 'TriggerEmails_Stats_Open_Error_HasNotBeenOpened';
					$tempRestriction = $this->CalendarRestrictions;

					if ($triggerrecord['triggeractions']['send']['trackopens'] == 0) {
						$tempMessage = 'TriggerEmails_Stats_Open_Error_NotOpenTracked';
					} elseif (array_key_exists('opens', $tempRestriction) && !empty($tempRestriction['opens'])) {
						$tempMessage = 'TriggerEmails_Stats_Open_Error_HasNotBeenOpened_CalendarProblem';
					}

					$GLOBALS['Error'] = GetLang($tempMessage);
					$tabs['open']['message'] = $this->ParseTemplate('ErrorMsg', true, false);
					unset($GLOBALS['Error']);


				// Set up open information otherwise
				} else {
					$tabs['open']['email_opens_total'] = $this->FormatNumber($record['processed_timeframe_emailopens_total']);
					$tabs['open']['email_opens_unique'] = $this->FormatNumber($record['processed_timeframe_emailopens_unique']);

					// ----- Most opens
						$tempMostOpens = $api->GetMostOpens($record['statid'], $this->CalendarRestrictions['opens']);
						$tempNow = getdate();

						if (isset($tempMostOpens['mth'])) {
							$tabs['open']['most_open_date'] = $this->Months[$tempMostOpens['mth']] . ' ' . $tempMostOpens['yr'];

						} elseif (isset($tempMostOpens['hr'])) {
							$tabs['open']['most_open_date'] = date(GetLang('Daily_Time_Display'),mktime($tempMostOpens['hr'], 1, 1, 1, 1, $tempNow['year']));

						} elseif (isset($tempMostOpens['dow'])) {
							$pos = array_search($tempMostOpens['dow'], array_keys($this->days_of_week));
							$tabs['open']['most_open_date'] = date(GetLang('Date_Display_Display'), strtotime("last " . $this->days_of_week[$pos]));

						} elseif (isset($tempMostOpens['dom'])) {
							$month = $tempNow['mon'];
							// if the day-of-month is after "today", it's going to be for "last month" so adjust the month accordingly.
							if ($tempMostOpens['dom'] > $tempNow['mday']) {
								$month = $tempNow['mon'] - 1;
							}

							$tabs['open']['most_open_date'] = date(GetLang('Date_Display_Display'),mktime(0, 0, 1, $month, $tempMostOpens['dom'], $tempNow['year']));
						}

						unset($tempNow);
						unset($tempMostOpens);
					// -----

					// ----- Average opens
						$tabs['open']['average_opens'] = 0;
						if ($record['processed_totalsent'] > 0) {
							$tempAverage = $record['processed_timeframe_emailopens_total'] / $record['processed_totalsent'];
							$tabs['open']['average_opens'] = $this->FormatNumber($tempAverage, 3);
							unset($tempAverage);
						}
					// -----

					// ----- Open rate
						$tabs['open']['open_rate'] = '0%';
						if ($record['processed_totalsent'] > 0) {
							$tempOpenRate = $record['processed_timeframe_emailopens_unique'] / $record['processed_totalsent'] * 100;
							$tabs['open']['open_rate'] = $this->FormatNumber($tempOpenRate, 2) . '%' ;
							unset($tempOpenRate);
						}
					// -----

					// Setup chart
					$this->DisplayChart('OpenChart', 'triggeremails', $record['statid'], 'column', array('graph_title' => GetLang('OpensChart')));
					$tabs['open']['open_chart'] = $GLOBALS['OpenChart'];
					unset($GLOBALS['OpenChart']);
				}
			// -----

			// ----- Tab 3: Links (TODO: when user chooses a specific link. Currently this is being ignored)
				$tabs['links']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Links_Intro'), $record['triggeremailsname']);

				// setup calendar
				$GLOBALS['TabID'] = '2';
				$this->SetupCalendar('Action=ProcessCalendar&SubAction=TriggerEmails&NextAction=View&tab=3&id=' . $id);
				$tabs['links']['calendar'] = $GLOBALS['Calendar'];
				unset($GLOBALS['TabID']);
				unset($GLOBALS['Calendar']);

				// Set up error message if no "links" count is not available
				if (!array_key_exists('processed_timeframe_linkclicks_total', $record) || !$record['processed_timeframe_linkclicks_total']) {
					$tempMessage = 'TriggerEmails_Stats_Links_Error_NoLinksFound';
					$tempRestriction = $this->CalendarRestrictions;

					if ($triggerrecord['triggeractions']['send']['tracklinks'] == 0) {
						$tempMessage = 'TriggerEmails_Stats_Links_Error_NotLinkTracked';
					} elseif (array_key_exists('clicks', $tempRestriction) && !empty($tempRestriction['clicks'])) {
						$tempMessage = 'TriggerEmails_Stats_Links_Error_NoLinksFound_CalendarProblem';
					}

					$GLOBALS['Error'] = GetLang($tempMessage);
					$tabs['links']['message'] = $this->ParseTemplate('ErrorMsg', true, false);
					unset($GLOBALS['Error']);


				// Set up open information otherwise
				} else {
					$tabs['links']['linkclicks_total'] = $this->FormatNumber($record['processed_timeframe_linkclicks_total']);
					$tabs['links']['linkclicks_unique'] = $this->FormatNumber($record['processed_timeframe_linkclicks_unique']);
					$tabs['links']['linkclicks_individuals'] = $this->FormatNumber($record['processed_timeframe_linkclicks_individuals']);

					// ----- Most popular
						$most_popular_link = $api->GetMostPopularLink($record['statid'], 'a', $this->CalendarRestrictions['clicks']);
						$most_popular_link = htmlspecialchars($most_popular_link, ENT_QUOTES, SENDSTUDIO_CHARSET);

						$tabs['links']['most_popular_link'] = $most_popular_link;
						$tabs['links']['most_popular_link_short'] = $this->TruncateName($most_popular_link, 20);

						unset($most_popular_link);
					// -----

					// ----- Average clicks per-email-opens
						$tabs['links']['average_clicks'] = '0';
						if ($record['emailopens'] > 0) {
							$tabs['links']['average_clicks'] = $this->FormatNumber(($record['linkclicks'] / $record['emailopens']), 3);
						}
					// -----

					// ----- Clickthrough rate
						$tabs['links']['click_through'] = '0%';
						if ($record['processed_totalsent'] > 0) {
							$tempClickThroughRate = $record['processed_timeframe_linkclicks_unique'] / $record['processed_totalsent'] * 100;
							$tabs['links']['click_through'] = $this->FormatNumber($tempClickThroughRate, 2) . '%';
							unset($tempClickThroughRate);
						}
					// -----

					// Setup chart
					$this->DisplayChart('LinksChart', 'triggeremails', $record['statid'], 'column', array('graph_title' => GetLang('LinksClickedChart')));
					$tabs['links']['link_chart'] = $GLOBALS['LinksChart'];
					unset($GLOBALS['LinksChart']);
				}
			// -----

			// ----- Tab 4: Bounces (TODO: Cannot filter the bounce under soft/hard)
				$tabs['bounces']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Bounces_Intro'), $record['triggeremailsname']);

				// setup calendar
				$GLOBALS['TabID'] = '3';
				$this->SetupCalendar('Action=ProcessCalendar&SubAction=TriggerEmails&NextAction=View&tab=4&id=' . $id);
				$tabs['bounces']['calendar'] = $GLOBALS['Calendar'];
				unset($GLOBALS['TabID']);
				unset($GLOBALS['Calendar']);

				// Set up error message if no "bounces" count is not available
				if (!array_key_exists('processed_timeframe_bounces', $record) || !$record['processed_timeframe_bounces']) {
					$tempMessage = 'TriggerEmails_Stats_Bounces_Error_NoBouncesFound';
					$tempRestriction = $this->CalendarRestrictions;

					if (array_key_exists('clicks', $tempRestriction) && !empty($tempRestriction['clicks'])) {
						$tempMessage = 'TriggerEmails_Stats_Links_Error_NoLinksFound_CalendarProblem';
					}

					$GLOBALS['Error'] = GetLang($tempMessage);
					$tabs['bounces']['message'] = $this->ParseTemplate('ErrorMsg', true, false);
					unset($GLOBALS['Error']);


				// Set up open information otherwise
				} else {
					$tabs['bounces']['bounces_total'] = $this->FormatNumber($record['processed_totalbounced']);
					$tabs['bounces']['bounces_soft'] = $this->FormatNumber(intval($record['bouncecount_soft']));
					$tabs['bounces']['bounces_hard'] = $this->FormatNumber(intval($record['bouncecount_hard']));
					$tabs['bounces']['bounces_unknown'] = $this->FormatNumber(intval($record['bouncecount_unknown']));

					// Setup chart
					$this->DisplayChart('BounceChart', 'triggeremails', $record['statid'], 'column', array('graph_title' => GetLang('BounceChart')));
					$tabs['bounces']['bounce_chart'] = $GLOBALS['BounceChart'];
					unset($GLOBALS['BounceChart']);
				}
			// -----

			// ----- Tab 5: Unsubscribe
				$tabs['unsubscribes']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Unsubscribes_Intro'), $record['triggeremailsname']);

				// setup calendar
				$GLOBALS['TabID'] = '4';
				$this->SetupCalendar('Action=ProcessCalendar&SubAction=TriggerEmails&NextAction=View&tab=5&id=' . $id);
				$tabs['unsubscribes']['calendar'] = $GLOBALS['Calendar'];
				unset($GLOBALS['TabID']);
				unset($GLOBALS['Calendar']);

				// Set up error message if no "unsubscribes" count is not available
				if (!array_key_exists('processed_timeframe_unsubscribes', $record) || !$record['processed_timeframe_unsubscribes']) {
					$tempMessage = 'TriggerEmails_Stats_Unsubscribes_Error_NoUnsubscribesFound';
					$tempRestriction = $this->CalendarRestrictions;

					if (array_key_exists('bounces', $tempRestriction) && !empty($tempRestriction['bounces'])) {
						$tempMessage = 'TriggerEmails_Stats_Unsubscribes_Error_NoUnsubscribesFound_CalendarProblem';
					}

					$GLOBALS['Error'] = GetLang($tempMessage);
					$tabs['unsubscribes']['message'] = $this->ParseTemplate('ErrorMsg', true, false);
					unset($GLOBALS['Error']);


				// Set up open information otherwise
				} else {
					$tabs['unsubscribes']['unsubscribes_total'] = $this->FormatNumber($record['processed_timeframe_unsubscribes']);

					// ----- Most unsubscribe
						$tempMostUnsubscribes = $api->GetMostUnsubscribes($record['statid'], $this->CalendarRestrictions['unsubscribes']);
						$tempNow = getdate();

						if (isset($tempMostUnsubscribes['mth'])) {
							$tabs['unsubscribes']['unsubscribes_most'] = $this->Months[$tempMostUnsubscribes['mth']] . ' ' . $tempMostUnsubscribes['yr'];

						} elseif (isset($tempMostUnsubscribes['hr'])) {
							$tabs['unsubscribes']['unsubscribes_most'] = $this->PrintDate(mktime($tempMostUnsubscribes['hr'], 1, 1, 1, 1, $tempNow['year']), GetLang('Daily_Time_Display'));

						} elseif (isset($tempMostUnsubscribes['dow'])) {
							$pos = array_search($tempMostUnsubscribes['dow'], array_keys($this->days_of_week));
							// we need to add 1 hour here otherwise we get the wrong day from strtotime.
							$tabs['unsubscribes']['unsubscribes_most'] = $this->PrintDate(strtotime("last " . $this->days_of_week[$pos] . " +1 hour"), GetLang('Date_Display_Display'));

						} elseif (isset($tempMostUnsubscribes['dom'])) {
							$month = $tempNow['mon'];
							// if the day-of-month is after "today", it's going to be for "last month" so adjust the month accordingly.
							if ($tempMostUnsubscribes['dom'] > $tempNow['mday']) {
								$month = $tempNow['mon'] - 1;
							}

							$tabs['unsubscribes']['unsubscribes_most'] = $this->PrintDate(mktime(0, 0, 1, $month, $tempMostUnsubscribes['dom'], $tempNow['year']), GetLang('Date_Display_Display'));
						}

						unset($tempNow);
						unset($tempMostUnsubscribes);
					// -----

					// Setup chart
					$this->DisplayChart('UnsubscribeChart', 'triggeremails', $record['statid'], 'column', array('graph_title' => GetLang('UnsubscribesChart')));
					$tabs['unsubscribes']['unsubscribe_chart'] = $GLOBALS['UnsubscribeChart'];
					unset($GLOBALS['UnsubscribeChart']);
				}
			// -----

			// ----- Tab 6: Forwards
				$tabs['forwards']['intro'] = sprintf(GetLang('TriggerEmails_Stats_Forwards_Intro'), $record['triggeremailsname']);

				// setup calendar
				$GLOBALS['TabID'] = '5';
				$this->SetupCalendar('Action=ProcessCalendar&SubAction=TriggerEmails&NextAction=View&tab=6&id=' . $id);
				$tabs['forwards']['calendar'] = $GLOBALS['Calendar'];
				unset($GLOBALS['TabID']);
				unset($GLOBALS['Calendar']);

				// Set up error message if no "forwards" count is not available
				if (!array_key_exists('processed_timeframe_forwards', $record) || !$record['processed_timeframe_forwards']) {
					$tempMessage = 'TriggerEmails_Stats_Forwards_Error_NoForwardFound';
					$tempRestriction = $this->CalendarRestrictions;

					if (array_key_exists('forwards', $tempRestriction) && !empty($tempRestriction['forwards'])) {
						$tempMessage = 'TriggerEmails_Stats_Forwards_Error_NoForwardFound_CalendarProblem';
					}

					$GLOBALS['Error'] = GetLang($tempMessage);
					$tabs['forwards']['message'] = $this->ParseTemplate('ErrorMsg', true, false);
					unset($GLOBALS['Error']);


				// Set up open information otherwise
				} else {
					$tabs['forwards']['forward_total'] = $this->FormatNumber($record['processed_timeframe_forwards']);

					// ----- Total new Signups
						$temp = intval($api->GetForwards($record['statid'], 1, 'all', $this->CalendarRestrictions['forwards'], true, true));
						$tabs['forwards']['forward_signups'] = $this->FormatNumber($temp);
						unset($temp);
					// -----

					// Setup chart
					$this->DisplayChart('ForwardsChart', 'triggeremails', $record['statid'], 'column', array('graph_title' => GetLang('ForwardsChart')));
					$tabs['forwards']['forwards_chart'] = $GLOBALS['ForwardsChart'];
					unset($GLOBALS['ForwardsChart']);
				}
			// -----

			// ----- Tab 7: Contact info
				$tabs['recipients'] = $this->_TriggerEmailsStats_View_Tab7($record);
			// -----

			// ----- Tab 8: Failed sending info
				$tabs['failed'] = $this->_TriggerEmailsStats_View_Tab8($record);
			// -----



			// ----- Print HTML
				$tpl = GetTemplateSystem();
				$tpl->Assign('PAGE', $page);
				$tpl->Assign('record', $record);
				$tpl->Assign('tabs', $tabs);

				return $tpl->ParseTemplate('Stats_Triggeremails_Summary', true);
			// -----
		}
Пример #15
0
		/**
		 * Display the quick view for an order
		 *
		 * @return void
		 **/
		public function GetOrderQuickView()
		{
			$this->engine->loadLangFile('orders');

			if(empty($_REQUEST['o'])) {
				exit;
			}

			$orderId = (int)$_REQUEST['o'];

			// Get the details for this order from the database
			$query = "
				SELECT o.*, CONCAT(custconfirstname, ' ', custconlastname) AS custname, custconemail, custconphone,
				(SELECT COUNT(messageid) FROM [|PREFIX|]order_messages WHERE messageorderid=orderid AND messagestatus='unread') AS numunreadmessages
				FROM [|PREFIX|]orders o
				LEFT JOIN [|PREFIX|]customers c ON (c.customerid=o.ordcustid)
				WHERE o.orderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			$order = $GLOBALS['ISC_CLASS_DB']->Fetch($result);

			$orderStatuses = array();
			$query = "
				SELECT *
				FROM [|PREFIX|]order_status
				ORDER BY statusorder ASC
			";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($status = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
				$orderStatuses[$status['statusid']] = $status['statusdesc'];
			}
			$this->template->assign('orderStatuses', $orderStatuses);

			// Order wasn't found
			if(!$order) {
				echo getLang('OrderDetailsNotFound');
				exit;
			}
			// If this user is a vendor, do they have permission to acess this order?
			else if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $row['ordvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
				echo getLang('OrderDetailsNotFound');
				exit;
			}

			$addressTypes = array(
				'billingAddress' => 'ordbill',
			);

			// Build the address fields
			foreach($addressTypes as $var => $dbKey) {
				$address = array(
					'firstname'	=> $order[$dbKey.'firstname'],
					'lastname'	=> $order[$dbKey.'lastname'],
					'company'	=> $order[$dbKey.'company'],
					'address1'	=> $order[$dbKey.'street1'],
					'address2'	=> $order[$dbKey.'street2'],
					'city'		=> $order[$dbKey.'suburb'],
					'state'		=> $order[$dbKey.'state'],
					'zip'		=> $order[$dbKey.'zip'],
					'country'	=> $order[$dbKey.'country']
				);
				if($order[$dbKey.'countrycode'] &&
					file_exists(ISC_BASE_PATH.'/lib/flags/'.strtolower($order[$dbKey.'countrycode']).'.gif')) {
						$address['countryFlag'] = strtolower($order[$dbKey.'countrycode']);
				}
				$this->template->assign($var, $address);
			}

			$itemTotalColumn = 'total_ex_tax';
			$shippingCostColumn = 'cost_ex_tax';
			if(getConfig('taxDefaultTaxDisplayOrders') == TAX_PRICES_DISPLAY_INCLUSIVE) {
				$itemTotalColumn = 'total_inc_tax';
				$shippingCostColumn = 'cost_inc_tax';
			}

			// Does the payment method have any extra info to show?
			$provider = null;
			if(GetModuleById('checkout', $provider, $order['orderpaymentmodule'])) {
				if(method_exists($provider, "DisplayPaymentDetails")) {
					$this->template->assign('orderExtraInfo', $provider->DisplayPaymentDetails($order));
				}
			}

			if($order['extrainfo']) {
				$extraArray = unserialize($order['extrainfo']);
				if(!empty($extraArray['payment_message'])) {
					$order['payment_message'] = $extraArray['payment_message'];
				}
			}

			// Fetch all of the addresses in this order
			$orderAddresses = array();
			$query = "
				SELECT *
				FROM [|PREFIX|]order_addresses
				WHERE order_id='".$order['orderid']."'
			";
			$result = $this->db->query($query);
			while($address = $this->db->fetch($result)) {
				if($address['country_iso2'] &&
					file_exists(ISC_BASE_PATH.'/lib/flags/'.strtolower($address['country_iso2']).'.gif')) {
						$address['countryFlag'] = strtolower($address['country_iso2']);
				}
				$orderAddresses[$address['id']] = array(
					'address' => $address,
					'shipping' => array(),
					'products' => array(),
				);

				// Grab any custom form fields
				if($address['form_session_id']) {
					$orderAddresses[$address['id']]['customFields'] =
						$GLOBALS['ISC_CLASS_FORM']->getSavedSessionData(
							$address['form_session_id'],
							array(),
							FORMFIELDS_FORM_SHIPPING,
							true
						);
				}
			}

			// Fetch the shipping details for this order
			$query = "
				SELECT *
				FROM [|PREFIX|]order_shipping
				WHERE order_id='".$order['orderid']."'
			";
			$result = $this->db->query($query);
			while($shipping = $this->db->fetch($result)) {
				$shipping['cost'] = $shipping[$shippingCostColumn];
				$orderAddresses[$shipping['order_address_id']]['shipping'] = $shipping;
			}

			// Get the products in the order
			$prodFieldsArray = getClass('ISC_ADMIN_ORDERS')->getOrderProductFieldsData($orderId);

			// Get the products in the order
			$products = array();
			$query = "
				SELECT o.*, p.productid, p.prodname, p.prodpreorder, p.prodreleasedate, p.prodpreordermessage
				FROM [|PREFIX|]order_products o
				LEFT JOIN [|PREFIX|]products p ON (p.productid=o.ordprodid)
				WHERE orderorderid='" . $orderId . "'
				ORDER BY ordprodname";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($product = $this->db->fetch($result)) {
				if($product['ordprodoptions'] != '') {
					$product['options'] = unserialize($product['ordprodoptions']);
				}

				if(isset($prodFieldsArray[$product['orderprodid']])) {
					$product['configurable_fields'] = $prodFieldsArray[$product['orderprodid']];
				}

				if($product['prodname']) {
					$product['prodlink'] = prodLink($product['prodname']);
				}

				if($product['productid'] && $product['prodpreorder']) {
					$message = getLang('Thisisapreordereditem');
					if($product['prodreleasedate']) {
						$message = $product['prodpreordermessage'];
						if(!$message) {
							$message = getConfig('DefaultPreOrderMessage');
						}
						$message = str_replace('%%DATE%%', isc_date(getConfig('DisplayDateFormat'), $product['prodreleasedate']), $message);
					}
					$product['preorder_message'] = $message;
				}

				if($product['ordprodeventdate']) {
					$product['ordprodeventdate'] = isc_date('jS M Y', $product['ordprodeventdate']);
				}

				$product['total'] = $product[$itemTotalColumn];

				$productAddressId = $product['order_address_id'];
				if(!isset($orderAddresses[$productAddressId])) {
					$orderAddresses[$productAddressId] = array(
						'products' => array()
					);
				}
				$orderAddresses[$productAddressId]['products'][] = $product;
			}
			$this->template->assign('orderAddresses', $orderAddresses);

			$this->template->assign('totalRows', getOrderTotalRows($order));

			if (gzte11(ISC_MEDIUMPRINT) && isId($order['ordformsessionid'])) {
				$billingFields = $GLOBALS['ISC_CLASS_FORM']->getSavedSessionData(
					$order['ordformsessionid'],
					array(),
					FORMFIELDS_FORM_BILLING,
					true
				);
				$this->template->assign('billingCustomFields', $billingFields);

				$shippingFields = $GLOBALS['ISC_CLASS_FORM']->getSavedSessionData(
					$order['ordformsessionid'],
					array(),
					FORMFIELDS_FORM_SHIPPING,
					true
				);
				$this->template->assign('shippingCustomFields', $shippingFields);
			}

			$this->template->assign('order', $order);
			$this->template->assign('orderStatusOptions',
				getClass('ISC_ADMIN_ORDERS')->getOrderStatusOptions($order['ordstatus'])
			);

			$message = '';
			$flashMessages = GetFlashMessages();
			if(is_array($flashMessages)) {
				foreach($flashMessages as $flashMessage) {
					$message .= MessageBox($flashMessage['message'], $flashMessage['type']);
				}
			}
			$this->template->assign('message', $message);

			$this->template->display('order.quickview.tpl');
		}
Пример #16
0
		protected function ManageOrders($MsgDesc = "", $MsgStatus = "")
		{
			$GLOBALS['HideClearResults'] = "none";
			$status = array();
			$num_custom_searches = 0;
			$numOrders = 0;

			// Fetch any results, place them in the data grid
			$GLOBALS['OrderDataGrid'] = $this->ManageOrdersGrid($numOrders, $numDeletedOrders);

			// Was this an ajax based sort? Return the table now
			if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
				echo $GLOBALS['OrderDataGrid'];
				return;
			}

			if(isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
				$GLOBALS['HideClearResults'] = "";
			}

			if(isset($this->_customSearch['searchname'])) {
				$GLOBALS['ViewName'] = $this->_customSearch['searchname'];

				if(!empty($this->_customSearch['searchlabel'])) {
					$GLOBALS['HideDeleteViewLink'] = "none";
				}
			}
			else {
				$GLOBALS['ViewName'] = GetLang('AllOrders');
				$GLOBALS['HideDeleteViewLink'] = "none";
			}

			// Do we display the add order buton?
			if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Add_Orders)) {
				$GLOBALS['AddOrderButton'] = '<input type="button" value="' . GetLang('AddAnOrder') . '..." class="FormButton" style="width:100px" onclick="document.location.href=\'index.php?ToDo=addOrder\'" />';
			} else {
				$GLOBALS['AddOrderButton'] = '';
			}

			$GLOBALS['OrderActionOptions'] = '<option selected="1">' . GetLang('ChooseAction') . '</option>';

			$searchDeletedOrders = 'no';
			if (isset($_REQUEST['searchDeletedOrders'])) {
				$searchDeletedOrders = $_REQUEST['searchDeletedOrders'];
			}

			if ($searchDeletedOrders != 'only') {
				// Do we need to disable the delete button?
				if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Delete_Orders) || $numOrders == 0) {
					$args = 'disabled="disabled"';
				} else {
					$args = 'value="delete"';
				}

				$GLOBALS['OrderActionOptions'] .= '<option ' . $args . '>' . GetLang('DeleteSelected') . '</option>';
			}

			$searchGet = $_GET;
			if (isset($searchGet['searchId']) && $searchGet['searchId'] == 0) {
				// this is a nasty hack but I can't right now figure out a better way of making count($_GET) work as
				// expected when the clicking 'view: all orders' which is '&ToDo=viewOrders&searchId=0'
				unset($searchGet['searchId']);
			}

			if ($searchDeletedOrders != 'no') {
				if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Undelete_Orders) || $numOrders == 0) {
					$GLOBALS['OrderActionOptions'] .= '<option disabled="disabled">' . isc_html_escape(GetLang('UndeleteSelected')) . '</option>';
				} else {
					$GLOBALS['OrderActionOptions'] .= '<option value="undelete">' . isc_html_escape(GetLang('UndeleteSelected')) . '</option>';
				}

				if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Purge_Orders) || $numOrders == 0) {
					$GLOBALS['OrderActionOptions'] .= '<option disabled="disabled">' . isc_html_escape(GetLang('PurgeSelected')) . '</option>';
				} else {
					$GLOBALS['OrderActionOptions'] .= '<option value="purge">' . isc_html_escape(GetLang('PurgeSelected')) . '</option>';
				}
			}

			if ($searchDeletedOrders == 'only' && GetConfig('DeletedOrdersAction') == 'purge') {
				// show a notice about searching for deleted orders when the feature is turned off
				FlashMessage(GetLang('OrderArchivingIsTurnedOff'), MSG_INFO);
			}

			if($numOrders > 0) {
				if($MsgDesc == "" && (isset($_REQUEST['searchQuery']) || count($searchGet) > 1) && !isset($_GET['selectOrder'])) {
					if($numOrders == 1) {
						$MsgDesc = GetLang('OrderSearchResultsBelow1');
					}
					else {
						$MsgDesc = sprintf(GetLang('OrderSearchResultsBelowX'), $numOrders);
					}

					$MsgStatus = MSG_SUCCESS;
				}
				$args1 = 'value="printInvoice"';
				$args2 = 'value="printSlip"';
			}
			else {
				$args1 = 'disabled="disabled"';
				$args2 = 'disabled="disabled"';
			}

			$GLOBALS['OrderActionOptions'] .= '<option ' . $args1 . '>' . GetLang('PrintInvoicesSelected') . '</option>';
			$GLOBALS['OrderActionOptions'] .= '<option ' . $args2 . '>' . GetLang('PrintPackingSlipsSelected') . '</option>';

			if(!gzte11(ISC_MEDIUMPRINT)) {
				$GLOBALS[base64_decode('SGlkZUV4cG9ydA==')] = "none";
				$GLOBALS[B('ZGlzYWJsZU9yZGVyRXhwb3J0cw==')] = true;
			}

			$GLOBALS['OrderActionOptions'] .= '<option disabled="disabled"></option><optgroup label="' . GetLang('BulkOrderStatus') . '">';

			$result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_status ORDER BY statusorder ASC");
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$GLOBALS['OrderActionOptions'] .= '<option value="updateStatus' . $row['statusid'] . '">' . $row['statusdesc'] . '</option>';
			}
			$GLOBALS['OrderActionOptions'] .= '</optgroup>';

			if (!isset($_REQUEST['searchId'])) {
				$_REQUEST['searchId'] = 0;
			}

			// Get the custom search as option fields
			$GLOBALS['CustomSearchOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions($_REQUEST['searchId'], $num_custom_searches, "AllOrders", "viewOrders", "customOrderSearch");

			// the above is pre-formatted, need it as raw data for the iphone
			$GLOBALS['customSearchList'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearches();

			if(!isset($_REQUEST['searchId'])) {
				$GLOBALS['HideDeleteCustomSearch'] = "none";
			} else {
				$GLOBALS['CustomSearchId'] = (int)$_REQUEST['searchId'];
			}

			$GLOBALS['OrderIntro'] = GetLang('ManageOrdersIntro');
			$GLOBALS['Message'] = '';

			// No orders
			if($numOrders == 0) {
				$GLOBALS['DisplayGrid'] = "none";

				if(count($searchGet) > 1) {
					// Performing a search of some kind
					if ($MsgDesc == "") {
						$GLOBALS['Message'] = MessageBox(GetLang('NoOrderResults'), MSG_ERROR);
						if ($numDeletedOrders) {
							$deletedUrl = $searchGet;
							$deletedUrl['searchDeletedOrders'] = 'only';
							$deletedUrl = 'index.php?' . http_build_query($deletedUrl);

							$GLOBALS['Message'] .= MessageBox(GetLang('DeletedOrdersMatchedYourSearch', array(
								'viewDeletedOrdersUrl' => $deletedUrl,
							)), MSG_INFO, 'MessageBoxTrash');
							unset($deletedUrl);
						}
					}
				} else {
					$GLOBALS['Message'] = MessageBox(GetLang('NoOrders'), MSG_SUCCESS);
					$GLOBALS['DisplaySearch'] = "none";
				}

				unset($searchGet);
			}

			if($MsgDesc != "") {
				$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
			}

			$flashMessages = GetFlashMessages();
			if(is_array($flashMessages)) {
				foreach($flashMessages as $flashMessage) {
					$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
				}
			}

			if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Export_Orders)) {
				$GLOBALS['ExportAction'] = "index.php?ToDo=startExport&t=orders";
				if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
					$GLOBALS['ExportAction'] .= "&searchId=" . $GLOBALS['CustomSearchId'];
				}
				else {
					$params = $_GET;
					unset($params['ToDo']);

					if (!empty($params)) {
						$GLOBALS['ExportAction'] .= "&" . http_build_query($params);
					}
				}
			}

			$selectOrder = '';
			if (!empty($_GET['selectOrder']) && isId($_GET['selectOrder'])) {
				$selectOrder = 'QuickView(' . $_GET['selectOrder'] . ');';
			}
			$GLOBALS['SelectOrder'] = $selectOrder;

			// Used for iPhone interface
			$GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions();

			if ($numOrders && $GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Export_Orders)) {
				$exportAction = "index.php?ToDo=startExport&t=orders";
				if (isset($GLOBALS['CustomSearchId']) && $GLOBALS['CustomSearchId'] != '0') {
					$exportAction .= "&searchId=" . $GLOBALS['CustomSearchId'];
				}
				else {
					$params = $_GET;
					unset($params['ToDo']);

					if (!empty($params)) {
						$exportAction .= "&" . http_build_query($params);
					}
				}

				$searchQueryForExport = $_POST + $_GET;
				foreach ($searchQueryForExport as $index => $value) {
					if ($value === '') {
						unset($searchQueryForExport[$index]);
					}
				}
				unset($searchQueryForExport['ToDo'], $searchQueryForExport['SubmitButton1'], $searchQueryForExport['sortField'], $searchQueryForExport['sortOrder'], $searchQueryForExport['SearchButton_x'], $searchQueryForExport['SearchButton_y']);
				$searchQueryForExport = isc_json_encode($searchQueryForExport);

				$orderExportMenu = array();

				$orderExportMenu[] = array(
					array(
						'backgroundImage' => 'images/export.gif',
						'label' => GetLang('EmailIntegrationExportToFile'),
						'class' => 'exportMenuLink',
						'href' => $exportAction,
					),
				);

				$emailModules = ISC_EMAILINTEGRATION::getConfiguredModules();
				foreach ($emailModules as /** @var ISC_EMAILINTEGRATION */$emailModule) {
					if (!$emailModule->supportsBulkExport()) {
						// not all modules have to support bulk exports
						continue;
					}

					$orderExportMenuModules[] = array(
						'backgroundImage' => '../modules/' . str_replace('_', '/', $emailModule->GetId()) . '/images/16x16.png',
						'label' => GetLang('EmailIntegrationExportToModule', array('module' => $emailModule->GetName())),
						'href' => 'javascript:Interspire_EmailIntegration_ModuleExportMachine.start({ exportType: "Order", exportModule: "' . $emailModule->GetId() . '", exportSearch: ' . $searchQueryForExport . ' });',
					);
				}

				if (!empty($orderExportMenuModules)) {
					$orderExportMenu[] = $orderExportMenuModules;

					$this->engine->bodyScripts[] = '../javascript/fsm.js';
					$this->engine->bodyScripts[] = '../javascript/jquery/plugins/disabled/jquery.disabled.js';
					$this->engine->bodyScripts[] = '../javascript/ajaxDataProvider.js';
					$this->engine->bodyScripts[] = 'script/emailintegration.js';
					$this->engine->bodyScripts[] = 'script/emailintegration.export.js';
				}

				$this->template->assign('orderExportMenu', $orderExportMenu);
			} else {
				$this->template->assign('disableOrderExports', true);
			}

			$this->template->display('orders.manage.tpl');
		}
Пример #17
0
	/**
	 * PrintAddonsList
	 * Prints a list of all addons that the system can use.
	 * It works out what step an addon is up to (whether it is configured, enabled, installed or not) and prints an appropriate action
	 *
	 * @uses Interspire_Addons
	 * @uses Interspire_Addons::GetAllAddons
	 * @uses Interspire_Addons::GetAvailableAddons
	 * @uses FlashMessage
	 * @uses GetFlashMessages
	 *
	 * @return String Returns a formatted (table design) list of addons and what they are up to (whether they need to be configured, installed, enabled etc).
	 */
	function PrintAddonsList()
	{
		require_once(SENDSTUDIO_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'addons' . DIRECTORY_SEPARATOR . 'interspire_addons.php');
		$addon_system = new Interspire_Addons();
		$addons = $addon_system->GetAllAddons();
		if (empty($addons)) {
			FlashMessage(GetLang('Addon_NoAddonsAvailable'), SS_FLASH_MSG_ERROR);
			$GLOBALS['Message'] .= GetFlashMessages();
			return $this->ParseTemplate('Settings_Addons_Empty', true, false);
		} else {
			$GLOBALS['Message'] .= GetFlashMessages();
		}

		$addons_status = $addon_system->GetAvailableAddons();

		$addons_list = '';

		$page = array(
			'message' => $GLOBALS['Message']
		);

		foreach ($addons as $addon_name => $details) {
			$addons[$addon_name]['name'] = htmlspecialchars($details['name'], ENT_QUOTES, SENDSTUDIO_CHARSET);
			$addons[$addon_name]['short_name'] = htmlspecialchars($this->TruncateName($details['name']), ENT_QUOTES, SENDSTUDIO_CHARSET);
			$addons[$addon_name]['description'] = htmlspecialchars($details['description'], ENT_QUOTES, SENDSTUDIO_CHARSET);
			$addons[$addon_name]['short_description'] = htmlspecialchars($this->TruncateName($details['description']), ENT_QUOTES, SENDSTUDIO_CHARSET);

			if (isset($addons_status[$addon_name])) {
				$addons[$addon_name]['install_details'] = $addons_status[$addon_name];
				$addons[$addon_name]['need_upgrade'] = (version_compare($details['addon_version'], $addons_status[$addon_name]['addon_version']) == 1);
			} else {
				$addons[$addon_name]['install_details'] = false;
			}
		}

		$tpl = GetTemplateSystem();
		$tpl->Assign('PAGE', $page);
		$tpl->Assign('records', $addons);
		return $tpl->ParseTemplate('Settings_Addons_Display', true);
	}
Пример #18
0
 /**
  * Admin_Action_Finished
  * This is the final status report.
  *
  * @see Admin_Action_Default
  * @see Admin_Action_ShowPopup
  *
  * @return Void Prints out the report, doesn't return anything.
  */
 public function Admin_Action_Finished()
 {
     $repaired = (bool) $this->_getGETRequest('Repair', false);
     $tables_status = IEM::sessionGet($this->addon_id . '_TablesStatus');
     list($num_problems, $problem_tables, $problems) = $this->SummariseProblems($tables_status);
     if ($repaired) {
         FlashMessage(GetLang('Addon_dbcheck_Repaired'), SS_FLASH_MSG_SUCCESS);
     } elseif ($num_problems) {
         $error_msg = sprintf(GetLang('Addon_dbcheck_Problems'), $num_problems);
         FlashMessage($error_msg, SS_FLASH_MSG_ERROR);
     } else {
         FlashMessage(GetLang('Addon_dbcheck_NoProblems'), SS_FLASH_MSG_SUCCESS);
     }
     $report = self::GenerateReport($tables_status);
     IEM::sessionSet($this->addon_id . '_TablesReport', $report);
     IEM::sessionSet($this->addon_id . '_TablesToCheck', $problem_tables);
     IEM::sessionSet($this->addon_id . '_StepNumber', 1);
     IEM::sessionSet($this->addon_id . '_TotalSteps', count($problem_tables));
     $flash_messages = GetFlashMessages();
     $this->template_system->Assign('repaired', $repaired);
     $this->template_system->Assign('problems', $problems);
     $this->template_system->Assign('num_problems', $num_problems);
     $this->template_system->Assign('admin_url', $this->admin_url);
     $this->template_system->Assign('report', $report);
     $this->template_system->Assign('flash_messages', $flash_messages);
     $this->template_system->ParseTemplate('final_report');
 }
Пример #19
0
	/**
	 * ManageLists
	 * Prints out the lists for management. This includes deleting subscribers, changing subscriber formats etc.
	 *
	 * @see GetPerPage
	 * @see GetCurrentPage
	 * @see GetSortDetails
	 * @see GetApi
	 * @see User_API::ListAdmin
	 * @see List_API::GetLists
	 * @see User_API::CanCreateList
	 * @see SetupPaging
	 * @see PrintDate
	 *
	 * @param Array $param Any parameters that needed to be passed into this function
	 *
	 * @return String HTML for all the Contact Lists the user has permission to see, paginated.
	 */
	private function ManageLists($param)
	{
		$user =& $param['user'];
		$folders = new Folders();

		if ($folders->InFolderMode()) {
			$perpage = 'all';
			$GLOBALS['Mode'] = 'Folder';
		} else {
			$perpage = $this->GetPerPage();
			$GLOBALS['Mode'] = 'List';
		}

		$DisplayPage = $this->GetCurrentPage();
		$start = 0;
		if ($perpage != 'all') {
			$start = ($DisplayPage - 1) * $perpage;
		}

		$sortinfo = $this->GetSortDetails();

		$all_lists = $user->GetLists();
		$check_lists = array_keys($all_lists);

		$listapi = $this->GetApi('Lists');

		$NumberOfLists = count($check_lists);

		// If we're a list admin, no point checking the lists - we have access to everything.
		if ($user->ListAdmin()) {
			$check_lists = null;
		}

		$mylists = $listapi->GetLists($check_lists, $sortinfo, false, $start, $perpage);

		$GLOBALS['Lists_AddButton'] = '';

		if ($user->CanCreateList() === true) {
			$GLOBALS['Lists_AddButton'] = $this->ParseTemplate('List_Create_Button', true, false);
		}

		if (!isset($GLOBALS['Message'])) {
			$GLOBALS['Message'] = '';
		}

		if ($NumberOfLists == 0) {
			$GLOBALS['Intro'] = GetLang('ListsManage');
			if ($user->CanCreateList() === true) {
				FlashMessage(GetLang('ListCreate'), SS_FLASH_MSG_SUCCESS);
			} else {
				FlashMessage(GetLang('ListAssign'), SS_FLASH_MSG_SUCCESS);
			}
			$GLOBALS['Message'] = GetFlashMessages();
			return $this->ParseTemplate('Lists_Manage_Empty', true);
		}

		$this->SetupPaging($NumberOfLists, $DisplayPage, $perpage);
		$GLOBALS['FormAction'] = 'Action=ProcessPaging';
		$paging = $this->ParseTemplate('Paging', true, false);

		if ($user->HasAccess('Lists', 'Delete')) {
			$GLOBALS['Option_DeleteList'] = '<option value="Delete">' . GetLang('Delete_Lists') . '</option>';
		}

		if ($user->HasAccess('Subscribers', 'Delete')) {
			$GLOBALS['Option_DeleteSubscribers'] = '<option value="DeleteAllSubscribers">' . GetLang('DeleteAllSubscribers') . '</option>';
		}

		$template = $this->ParseTemplate('Lists_Manage', true, false);

		$lists = array();

		foreach ($mylists as $pos => $listinfo) {
			$GLOBALS['Name'] = htmlspecialchars($listinfo['name'], ENT_QUOTES, SENDSTUDIO_CHARSET);
			$GLOBALS['Created'] = $this->PrintDate($listinfo['createdate']);

			$GLOBALS['SubscriberCount'] = $this->FormatNumber($listinfo['subscribecount']);

			$GLOBALS['ListAction'] = '';

			$GLOBALS['ListID'] = $listinfo['listid'];
			$GLOBALS['ListAction'] .= $this->ParseTemplate('Lists_Manage_ViewSubscribersLink', true);

			if ($user->HasAccess('Subscribers', 'Add')) {
				$GLOBALS['AddSubscriberListID'] = $listinfo['listid'];
				$GLOBALS['ListAction'] .= $this->ParseTemplate('Lists_Manage_AddSubscriberLink', true, false);
			}

			if ($listinfo['ownerid'] == $user->userid || $user->HasAccess('Lists', 'Edit', $listinfo['listid'])) {
				$GLOBALS['EditListID'] = $listinfo['listid'];
				$GLOBALS['ListAction'] .= $this->ParseTemplate('Lists_Manage_EditLink', true, false);
			} else {
				$GLOBALS['ListAction'] .= $this->DisabledItem('Edit');
			}

			// This checks whether the user is an admin or list admin, so we don't need to.
			$create_list = $user->CanCreateList();
			if ($create_list === true) {
				$GLOBALS['CopyListID'] = $listinfo['listid'];
				$GLOBALS['ListAction'] .= $this->ParseTemplate('Lists_Manage_Copy', true, false);
			} else {
				if ($create_list === false) {
					$itemtitle = 'ListCopyDisabled';
				} else {
					$itemtitle = 'ListCopyDisabled_TooMany';
				}
				$GLOBALS['ListAction'] .= $this->DisabledItem('Copy', $itemtitle);
			}

			if ($listinfo['ownerid'] == $user->userid || $user->HasAccess('Lists', 'Delete', $listinfo['listid'])) {
				$GLOBALS['DeleteListID'] = $listinfo['listid'];
				$GLOBALS['ListAction'] .= $this->ParseTemplate('Lists_Manage_DeleteLink', true, false);
			} else {
				$GLOBALS['ListAction'] .= $this->DisabledItem('Delete');
			}

			$GLOBALS['List'] = $listinfo['listid'];
			$fullname = GetLang('N/A');
			if ($listinfo['fullname'] != '') {
				$fullname = $listinfo['fullname'];
			} elseif ($listinfo['username'] != '') {
				$fullname = $listinfo['username'];
			}
			$GLOBALS['Fullname'] = htmlspecialchars($fullname, ENT_QUOTES, SENDSTUDIO_CHARSET);

			$listinfo['html'] = $this->ParseTemplate('Lists_Manage_Row', true, false);
			$lists[$listinfo['listid']] = $listinfo;
		}

		if ($folders->InFolderMode()) {

			// Organise the rows into their respective folders.
			$folder_type = 'list';
			$folders_api = $this->GetApi('Folders');
			$folder_list = $folders_api->GetFolderList($folder_type, $user->Get('userid'), $sortinfo);

			// Folder ID 0 is special -- it's the 'Uncategorised' or 'Orphan' folder.
			$folder_list[0]['name'] = GetLang('Folders_OrphanName');

			// Accumulate the HTML for each folder and list.
			$f_html = '';
			$orphan_html = '';
			foreach ($folder_list as $fid=>$folder) {
				$l_html = '';
				if (is_array($folder['items'])) {
					// Loop through $lists, as these will be sorted for us already.
					foreach ($lists as $lid=>$list) {
						if (in_array($lid, $folder['items'])) {
							$l_html .= $list['html'];
						}
					}
				}
				$GLOBALS['Items'] = $l_html;
				$GLOBALS['FolderID'] = $fid;
				$GLOBALS['FolderName'] = htmlspecialchars($folder['name']);
				$GLOBALS['FolderName_Encoded'] = urlencode($folder['name']);
				$GLOBALS['FolderType'] = $folder_type;
				$GLOBALS['Expanded'] = $folder['expanded'];
				if ($fid == 0) {
					if (!$folders->IsOrphanExpanded($folder_type)) {
						$GLOBALS['Expanded'] = 0;
					}
					$orphan_html .= $this->ParseTemplate('Folder', true, false);
					continue;
				}
				$f_html .= $this->ParseTemplate('Folder', true, false);
			}
			// The orphan folder should be put at the end
			$f_html .= $orphan_html;
			$template = str_replace('%%TPL_Lists_Manage_Row%%', $f_html, $template);
			$template = str_replace('%%TPL_Paging%%', '', $template);
			$template = str_replace('%%TPL_Paging_Bottom%%', '', $template);

		} else {

			// Not in folder mode, just print rows.
			$l_html = '';
			foreach ($lists as $list) {
				$l_html .= $list['html'];
			}
			$template = str_replace('%%TPL_Lists_Manage_Row%%', $l_html, $template);
			$template = str_replace('%%TPL_Paging%%', $paging, $template);
			$template = str_replace('%%TPL_Paging_Bottom%%', $GLOBALS['PagingBottom'], $template);
		}
		return $template;
	}
Пример #20
0
 public function Admin_Action_Process()
 {
     $id = !empty($_GET['id']) ? $_GET['id'] : 0;
     $api = $this->GetApi();
     $f = $api->fbl_details($id, true);
     if ($id != 0 && $f['exist'] == false) {
         FlashMessage(GetLang("Addon_fbl_Not_Exist"), SS_FLASH_MSG_ERROR, "index.php?Page=Addons&Addon=fbl");
     } else {
         $con = $api->connect($f['data']);
         $total = $api->count_fbl($con);
         $pinfo = $api->process($con, 800);
         $api->disconnect($con);
         FlashMessage(sprintf(GetLang("Addon_fbl_Processed"), $pinfo['processed'], $total), SS_FLASH_MSG_SUCCESS);
         $this->template_system->assign('value', $f['data']);
         $this->template_system->Assign('FlashMessages', GetFlashMessages(), false);
         $this->template_system->ParseTemplate('fbl_process');
     }
 }
Пример #21
0
	public function ManageLayouts($MsgDesc = "", $MsgStatus = "", $template = "")
	{
		$output = '';

		if(isset($_REQUEST['forceTab'])) {
			$GLOBALS['ForceTab'] = (int)$_REQUEST['forceTab'];
		}

		$opener = new connect_remote();
		if ($opener->CanOpen()) {
			$GLOBALS['FopenSupport'] = true;
		} else {
			$GLOBALS['FopenSupport'] = false;
		}

		$GLOBALS['CurrentTemplateName']  = GetConfig('template');
		$GLOBALS['CurrentTemplateNameProper']  = ucfirst(GetConfig('template'));
		$GLOBALS['CurrentTemplateColor'] = GetConfig('SiteColor');
		$GLOBALS['StoreLogo'] = GetConfig('StoreLogo');
		$GLOBALS['siteName']  = GetConfig('StoreName');

		$this->LoadChooseTemplateTab();
		$this->LoadDownloadTemplates();
		$this->LoadLogoTab();

		if(file_exists(ISC_BASE_PATH . '/templates/'. GetConfig('template') . '/config.php')) {
			include(ISC_BASE_PATH . '/templates/'. GetConfig('template') . '/config.php');
			if(isset($GLOBALS['TPL_CFG']['GenerateLogo']) && $GLOBALS['TPL_CFG']['GenerateLogo'] === true) {
				$GLOBALS['CurrentTemplateHasLogoOption'] = 'true';
			}
			else {
				$GLOBALS['CurrentTemplateHasLogoOption'] = 'false';
			}
		}

		if(GetConfig('DisableTemplateDownloading')) {
			$GLOBALS['HideDownloadTab'] = 'none';
		}

		$GLOBALS['TemplateVersion'] = '1.0';
		if(isset($GLOBALS['TPL_CFG']['Version'])) {
			$GLOBALS['TemplateVersion'] = $GLOBALS['TPL_CFG']['Version'];
		}

		$GLOBALS['LayoutIntro'] = GetLang('TemplateIntro');

		$GLOBALS['DesignModeToken'] = isc_html_escape($_COOKIE['STORESUITE_CP_TOKEN']);

		$GLOBALS['Message'] = '';

		if ($MsgDesc != "") {
			$GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
		}

		$flashMessages = GetFlashMessages();
		if(is_array($flashMessages)) {
			foreach($flashMessages as $flashMessage) {
				$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
			}
		}

		// Get the getting started box if we need to
		$GLOBALS['GettingStartedStep'] = '';
		if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) && !in_array('design', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
			$GLOBALS['GettingStartedTitle'] = GetLang('DesignYourStore');
			$GLOBALS['GettingStartedContent'] = GetLang('DesignYourStoreDesc');
			$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
		}

		// Mark the design step as complete
		GetClass('ISC_ADMIN_ENGINE')->MarkGettingStartedComplete('design');

		if(!function_exists("gzdeflate")) {
			// No zlib - they can't download templates automatically
			$GLOBALS['HideDownloadMessage'] = "none";
			$GLOBALS['NoZLibMessage'] = MessageBox(GetLang('NoZLibInstalled'), MSG_ERROR);
		}
		else {
			// They have zlib - hide the zlib error message
			$GLOBALS['HideNoZLib'] = "none";
		}

		if(!$this->safeMode) {
			$GLOBALS['HideSafeModeMessage'] = 'display: none';
		}

		// Mobile template settings tab
		$validSettings = array(
			'enableMobileTemplate',
			'enableMobileTemplateDevices',
			'mobileTemplateLogo',
		);
		$mobileSettings = array();
		foreach($validSettings as $setting) {
			$mobileSettings[$setting] = getConfig($setting);
		}
		$this->template->assign('mobileSettings', $mobileSettings);

		require_once ISC_BASE_PATH.'/lib/templates/template.php';
		$phoneTemplateConfig = TEMPLATE::getTemplateConfiguration('__mobile');
		$this->template->assign('phoneLogoDimensions', array(
			'width' => $phoneTemplateConfig['LogoWidth'],
			'height' => $phoneTemplateConfig['LogoHeight']
		));

		// Gift certificates tab
		if(GetConfig('EnableGiftCertificates')) {
			$GLOBALS['GiftCertificateThemes'] = ISC_GIFTCERTIFICATE_THEME::findAll();
		}

		// Load the email templates
		$GLOBALS['EmailTemplatesGrid'] = $this->GetEmailTemplateRows();

		$GLOBALS['TemplatesOrderCustomURL'] = GetConfig('TemplatesOrderCustomURL');

		// Load a temporary editor to use for editing email templates
		$wysiwygOptions = array(
			'id' => 'temp_email_editor',
			'delayLoad' => true
		);
		$GLOBALS['TemporaryEditor'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

		$GLOBALS['Favicon'] = GetConfig('ShopPath') . '/' . GetConfig('ImageDirectory') . '/' . GetConfig('Favicon');

		$this->template->display('layout.manage.tpl');
	}
Пример #22
0
 public function Admin_Action_Manage()
 {
     $api = $this->GetApi();
     $query = "SELECT * FROM " . SENDSTUDIO_TABLEPREFIX . "share";
     $ssf = new SendStudio_Functions();
     $result = $this->db->Query($query);
     $r = array();
     while ($row = $this->db->Fetch($result)) {
         $query = "SELECT COUNT(*) as total FROM " . SENDSTUDIO_TABLEPREFIX . "users WHERE share={$row['uid']}";
         $rc = $this->db->Query($query);
         $ut = $this->db->Fetch($rc);
         $row['users'] = $ut['total'];
         $r[] = $row;
     }
     $query = "SELECT * FROM " . SENDSTUDIO_TABLEPREFIX . "users";
     $result = $this->db->Query($query);
     $users = array();
     while ($row = $this->db->Fetch($result)) {
         $users[] = $row;
     }
     $this->template_system->Assign('shares', $r, false);
     $this->template_system->Assign('users', $users, false);
     $this->template_system->Assign('FlashMessages', GetFlashMessages(), false);
     $this->template_system->Assign('new_share', $ssf->GetHTMLEditor('', false, 'share', 'exact', 250, "99%"));
     $this->template_system->ParseTemplate('manage');
 }
Пример #23
0
 public function Admin_Action_Edit()
 {
     $this->Admin_Action_PreConfig();
     $me = self::LoadSelf();
     $formId = (int) IEM::requestGetGET('formId');
     // if a form id was given, load the corresponding form
     $surveysApi = $this->getApi();
     $this->_checkSurveyAccess($formId);
     $formId = $surveysApi->getId();
     if (!empty($formId)) {
         $widgetTemplates = array();
         $widgetapi = $this->getSpecificApi('widgets');
         $surveys_widgets = $surveysApi->getWidgets($formId);
         foreach ($surveys_widgets as $widget) {
             $widgetapi->SetId($widget['id']);
             $me->template_system->Assign('randomId', 'widget_' . md5(microtime()));
             $me->template_system->Assign('widget', $widget);
             $me->template_system->Assign('widgetFields', $widgetapi->getFields());
             $me->template_system->Assign('widgetFieldOther', $widgetapi->getOtherField());
             $widgetTemplates[] = $me->template_system->ParseTemplate('widget.' . $widget['type'], true);
         }
         $me->template_system->Assign('widgetTemplates', $widgetTemplates);
     } else {
         // now die here..
         FlashMessage(GetLang('Addon_Surveys_InvalidSurveyID'), SS_FLASH_MSG_ERROR);
         // default checkbox state
         $surveysApi->email_feedback = 1;
         // default action after submitting a form
         $surveysApi->after_submit = 'show_message';
         // the default message to be shown
         $surveysApi->show_message = GetLang('Addon_surveys_Settings_ShowMessage');
         // the default uri to be shown
         $surveysApi->show_uri = GetLang('Addon_surveys_Settings_ShowUri');
         // the default error message to be shown
         $surveysApi->error_message = GetLang('Addon_surveys_Settings_ErrorMessage');
         // the default error message to be shown
         $surveysApi->submit_button_text = GetLang('Addon_surveys_Settings_Submit');
     }
     // assign default form email
     if (!$surveysApi->Get('email')) {
         $surveysApi->email = $survey->emailaddress;
     }
     // assign survey and widget data
     $form_data = $surveysApi->GetData();
     foreach ($form_data as &$form_val) {
         $form_val = htmlspecialchars($form_val);
     }
     $me->template_system->Assign('Heading', GetLang('Addon_surveys_Heading_Edit'));
     $me->template_system->Assign('Intro', GetLang('Addon_surveys_Edit_Intro'));
     $me->template_system->Assign('FlashMessages', GetFlashMessages(), false);
     $me->template_system->Assign('form', $form_data);
     $me->template_system->ParseTemplate('survey_form');
 }
Пример #24
0
		private function ManageBanners()
		{
			// Fetch any results, place them in the data grid
			$numBanners = 0;
			$GLOBALS['BannersGrid'] = $this->ManageBannersGrid($numBanners);

			// Was this an ajax based sort? Return the table now
			if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
				echo $GLOBALS['BannersGrid'];
				return;
			}

			$flashMessages = GetFlashMessages();
			if(is_array($flashMessages)) {
				$GLOBALS['Message'] = '';
				foreach($flashMessages as $flashMessage) {
					$GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
				}
			}

			// Do we need to disable the delete button?
			if ($numBanners == 0) {
				$GLOBALS['DisableDelete'] = "DISABLED";
			}

			if ($numBanners == 0) {
				$GLOBALS['DisplayGrid'] = "none";

				if (count($_GET) == 1) {
					$GLOBALS['Message'] = MessageBox(GetLang('NoBanners'), MSG_SUCCESS);
					$GLOBALS['DisplaySearch'] = "none";
					$GLOBALS['DisableDelete'] = "DISABLED";
				} else {
					$GLOBALS['Message'] = MessageBox(GetLang('NoBannerResults'), MSG_SUCCESS);
					$GLOBALS['DisplaySearch'] = "";
					$GLOBALS['DisableDelete'] = "";
				}
			}

			$this->template->display('banners.manage.tpl');
		}
Пример #25
0
 public function AddProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost = false)
 {
     /*if($message = strtokenize($_REQUEST, '#')) {
     			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoError(GetLang(B('UmVhY2hlZFByb2R1Y3RMaW1pdA==')), $message, MSG_ERROR);
     			exit;
     		}*/
     /* Baskaran starts*/
     $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser();
     $userrole = $user['userrole'];
     if ($userrole != 'admin') {
         $GLOBALS['hideradio'] = 'none';
     } else {
         $GLOBALS['hideradio'] = '';
     }
     /* Baskaran ends*/
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     } else {
         $flashMessages = GetFlashMessages();
         if (is_array($flashMessages)) {
             $GLOBALS['Message'] = '';
             foreach ($flashMessages as $flashMessage) {
                 $GLOBALS['Message'] .= MessageBox($flashMessage['message'], $flashMessage['type']);
             }
         }
     }
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['CurrencyTokenLeft'] = '';
         $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
         $GLOBALS['CurrencyTokenRight'] = '';
     }
     // Delete any uploaded product downloads which are not attached to a product and older than 24h
     $query = sprintf("select downloadid, downfile from [|PREFIX|]product_downloads where downdateadded<'%d' and productid=0", time() - 86400);
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $dlids = array();
     while ($download = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         @unlink(APP_ROOT . "../" . GetConfig('DownloadDirectory') . "/" . $download['downfile']);
         $dlids[] = $download['downloadid'];
     }
     if (count($dlids) > 0) {
         $query = sprintf("delete from [|PREFIX|]product_downloads where downloadid in (%s)", implode(",", $dlids));
         $GLOBALS['ISC_CLASS_DB']->Query($query);
     }
     $GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions();
     $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
         $GLOBALS['HideStoreFeatured'] = 'display: none';
     } else {
         if (!gzte11(ISC_HUGEPRINT)) {
             $GLOBALS['HideVendorFeatured'] = 'display: none';
         }
     }
     // Set the global variables for the select boxes
     $from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
     $to_stamp = isc_gmmktime(0, 0, 0, isc_date("m") + 1, isc_date("d"), isc_date("Y"));
     $from_day = isc_date("d", $from_stamp);
     $from_month = isc_date("m", $from_stamp);
     $from_year = isc_date("Y", $from_stamp);
     $to_day = isc_date("d", $to_stamp);
     $to_month = isc_date("m", $to_stamp);
     $to_year = isc_date("Y", $to_stamp);
     $GLOBALS['OverviewFromDays'] = $this->_GetDayOptions($from_day);
     $GLOBALS['OverviewFromMonths'] = $this->_GetMonthOptions($from_month);
     $GLOBALS['OverviewFromYears'] = $this->_GetYearOptions($from_year);
     $GLOBALS['OverviewToDays'] = $this->_GetDayOptions($to_day);
     $GLOBALS['OverviewToMonths'] = $this->_GetMonthOptions($to_month);
     $GLOBALS['OverviewToYears'] = $this->_GetYearOptions($to_year);
     if ($PreservePost == true) {
         $this->_GetProductData(0, $arrData);
         $arrImages = $this->_GetImageData();
         $this->_GetCustomFieldData(0, $arrCustomFields);
         $GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"';
         $GLOBALS['ProdType'] = $arrData['prodtype'] - 1;
         $GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']);
         $GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']);
         $visibleCategories = array();
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
             if ($vendorData['vendoraccesscats']) {
                 $visibleCategories = explode(',', $vendorData['vendoraccesscats']);
             }
         }
         /* In the below line GetCategoryOptions() is changed to GetCategoryOptionsProduct() for not allowing user 
            to add product to main category if it has sub category  -- Baskaran */
         $GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptionsProduct($arrData['prodcats'], "<option %s value='%d' id='category_old%d'>%s</option>", "selected=\"selected\"", "", false, '', $visibleCategories);
         $GLOBALS['RelatedCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "- ", false);
         $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $arrData['proddesc']);
         //blessen
         $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodmfg']);
         $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodwarranty']);
         $wysiwygOptions3 = array('id' => 'wysiwyg3', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prod_instruction']);
         $wysiwygOptions4 = array('id' => 'wysiwyg4', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prod_article']);
         $wysiwygOptions5 = array('id' => 'wysiwyg5', 'width' => '60%', 'height' => '350px', 'value' => $arrData['proddescfeature']);
         $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
         $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1);
         $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2);
         $GLOBALS['WYSIWYG3'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions3);
         $GLOBALS['WYSIWYG4'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions4);
         $GLOBALS['WYSIWYG5'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions5);
         //$GLOBALS['instruction_file'] = "Current Instruction file : ".$arrData['instruction_file'];
         //$GLOBALS['article_file'] = "Current Article file : ".$arrData['article_file'];
         $GLOBALS['ProdSearchKeywords'] = $arrData['prodsearchkeywords'];
         $GLOBALS['ProdAvailability'] = $arrData['prodavailability'];
         $GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         if (CFloat($arrData['prodcostprice']) > 0) {
             $GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodretailprice']) > 0) {
             $GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodsaleprice']) > 0) {
             $GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         $GLOBALS['ProdSortOrder'] = $arrData['prodsortorder'];
         if ($arrData['prodvisible'] == 1) {
             $GLOBALS['ProdVisible'] = "checked";
         }
         if ($arrData['prodfeatured'] == 1) {
             $GLOBALS['ProdFeatured'] = "checked";
         }
         if ($arrData['prodvendorfeatured'] == 1) {
             $GLOBALS['ProdVendorFeatured'] = 'checked="checked"';
         }
         if ($arrData['prodistaxable'] == 1) {
             $GLOBALS['ProdIsTaxable'] = "checked";
         }
         if ($arrData['prodallowpurchases'] == 1) {
             $GLOBALS['ProdAllowPurchases'] = 'checked="checked"';
         } else {
             if ($arrData['prodhideprice'] == 1) {
                 $GLOBALS['ProdHidePrice'] = 'checked="checked"';
             }
         }
         $GLOBALS['ProdCallForPricing'] = isc_html_escape(@$arrData['prodCallForPricingLabel']);
         //blessen
         //$GLOBALS['ProdWarranty'] = $arrData['prodwarranty'];
         //$GLOBALS['prod_instruction'] = $arrData['prod_instruction'];
         //$GLOBALS['prod_article'] = $arrData['prod_article'];
         $GLOBALS['ProdWeight'] = number_format($arrData['prodweight'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
         if (CFloat($arrData['prodwidth']) > 0) {
             $GLOBALS['ProdWidth'] = number_format($arrData['prodwidth'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
         }
         if (CFloat($arrData['prodheight']) > 0) {
             $GLOBALS['ProdHeight'] = number_format($arrData['prodheight'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
         }
         if (CFloat($arrData['proddepth']) > 0) {
             $GLOBALS['ProdDepth'] = number_format($arrData['proddepth'], GetConfig('DimensionsDecimalPlaces'), GetConfig('DimensionsDecimalToken'), "");
         }
         if (CFloat($arrData['prodfixedshippingcost']) > 0) {
             $GLOBALS['ProdFixedShippingCost'] = number_format($arrData['prodfixedshippingcost'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if ($arrData['prodfreeshipping'] == 1) {
             $GLOBALS['FreeShipping'] = 'checked="checked"';
         }
         if ($arrData['prodrelatedproducts'] == -1) {
             $GLOBALS['IsProdRelatedAuto'] = 'checked="checked"';
         } else {
             if (isset($arrData['prodrelated'])) {
                 $GLOBALS['RelatedProductOptions'] = "";
                 foreach ($arrData['prodrelated'] as $r) {
                     $GLOBALS['RelatedProductOptions'] .= sprintf("<option value='%d'>%s</option>", $r[0], $r[1]);
                 }
             }
         }
         $GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect(explode(',', $arrData['prodwrapoptions']));
         $GLOBALS['HideGiftWrappingOptions'] = 'display: none';
         if ($arrData['prodwrapoptions'] == 0) {
             $GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"';
         } else {
             if ($arrData['prodwrapoptions'] == -1) {
                 $GLOBALS['WrappingOptionsNoneChecked'] = 'checked="checked"';
             } else {
                 $GLOBALS['HideGiftWrappingOptions'] = '';
                 $GLOBALS['WrappingOptionsCustomChecked'] = 'checked="checked"';
             }
         }
         $GLOBALS['CurrentStockLevel'] = $arrData['prodcurrentinv'];
         $GLOBALS['LowStockLevel'] = $arrData['prodlowinv'];
         $GLOBALS["InvTrack_" . $arrData['prodinvtrack']] = 'checked="checked"';
         if ($arrData['prodinvtrack'] == 1) {
             $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(true);";
         } else {
             $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);";
         }
         if ($arrData['prodoptionsrequired'] == 1) {
             $GLOBALS['ProdOptionRequired'] = 'checked="checked"';
         }
         if ($arrData['prodtype'] == 1) {
             $GLOBALS['HideProductInventoryOptions'] = "none";
         }
         if (GetConfig('PricesIncludeTax')) {
             $GLOBALS['PriceMsg'] = GetLang('IncTax');
         } else {
             $GLOBALS['PriceMsg'] = GetLang('ExTax');
         }
         $GLOBALS['CustomFields'] = '';
         $GLOBALS['CustomFieldKey'] = 0;
         if (!empty($arrCustomFields)) {
             foreach ($arrCustomFields as $f) {
                 $GLOBALS['CustomFieldName'] = isc_html_escape($f['name']);
                 $GLOBALS['CustomFieldValue'] = isc_html_escape($f['value']);
                 $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField'));
                 if (!$GLOBALS['CustomFieldKey']) {
                     $GLOBALS['HideCustomFieldDelete'] = 'none';
                 } else {
                     $GLOBALS['HideCustomFieldDelete'] = '';
                 }
                 $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields');
                 $GLOBALS['CustomFieldKey']++;
             }
         }
         // Add one more custom field
         $GLOBALS['CustomFieldName'] = '';
         $GLOBALS['CustomFieldValue'] = '';
         $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField'));
         if (!$GLOBALS['CustomFieldKey']) {
             $GLOBALS['HideCustomFieldDelete'] = 'none';
         } else {
             $GLOBALS['HideCustomFieldDelete'] = '';
         }
         $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields');
         // Get the brands as select options
         $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
         $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions($arrData['prodbrandid']);
         // Get a list of all layout files
         $layoutFile = 'product.html';
         if ($arrData['prodlayoutfile']) {
             $layoutFile = $arrData['prodlayoutfile'];
         }
         $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html", $layoutFile);
         $GLOBALS['ProdPageTitle'] = $arrData['prodpagetitle'];
         $GLOBALS['ProdMetaKeywords'] = $arrData['prodmetakeywords'];
         $GLOBALS['ProdMetaDesc'] = $arrData['prodmetadesc'];
     } else {
         $Cats = array();
         $Description = GetLang('TypeProductDescHere');
         $Description_manu = GetLang('TypeManuDescHere');
         //blessen
         $Description_war = GetLang('TypeWarDescHere');
         //blessen
         $Description_ins = GetLang('TypeProductInstruction');
         //blessen
         $Description_art = GetLang('TypeProductArticle');
         //blessen
         $Description_featuredpoints = GetLang('TypeFeaturedPoints');
         //blessen
         $GLOBALS['ProdType'] = 0;
         $GLOBALS["ProdType_1"] = 'checked="checked"';
         $GLOBALS['HideFile'] = "none";
         $visibleCategories = array();
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
             if ($vendorData['vendoraccesscats']) {
                 $visibleCategories = explode(',', $vendorData['vendoraccesscats']);
             }
         }
         /* In the below line GetCategoryOptions() is changed to GetCategoryOptionsProduct() for not allowing user 
            to add product to main category if it has sub category  -- Baskaran */
         $GLOBALS['CategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptionsProduct($Cats, "<option %s value='%d' id='category_old%d'>%s</option>", "selected=\"selected\"", "", false, '', $visibleCategories);
         $GLOBALS['RelatedCategoryOptions'] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($Cats, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "- ", false);
         //blessen
         $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $Description);
         $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $Description_manu);
         $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $Description_war);
         $wysiwygOptions3 = array('id' => 'wysiwyg3', 'width' => '60%', 'height' => '350px', 'value' => $Description_ins);
         $wysiwygOptions4 = array('id' => 'wysiwyg4', 'width' => '60%', 'height' => '350px', 'value' => $Description_art);
         $wysiwygOptions5 = array('id' => 'wysiwyg5', 'width' => '60%', 'height' => '350px', 'value' => $Description_featuredpoints);
         $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
         $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1);
         $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2);
         $GLOBALS['WYSIWYG3'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions3);
         $GLOBALS['WYSIWYG4'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions4);
         $GLOBALS['WYSIWYG5'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions5);
         $GLOBALS['ProdVisible'] = "checked";
         $GLOBALS['ProdSortOrder'] = 0;
         $GLOBALS['AutoGenThumb'] = 'checked="checked"';
         $GLOBALS["InvTrack_0"] = 'checked="checked"';
         $GLOBALS['HideProductInventoryOptions'] = "none";
         $GLOBALS['CurrentStockLevel'] = 0;
         $GLOBALS['LowStockLevel'] = 0;
         $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);";
         $GLOBALS['ExistingDownload'] = "false";
         $GLOBALS['HideUplaodThumbField'] = "none";
         $GLOBALS['IsProdRelatedAuto'] = 'checked="checked"';
         $GLOBALS['ProdIsTaxable'] = "checked";
         $GLOBALS['ProdAllowPurchases'] = 'checked="checked"';
         $GLOBALS['ProdCallForPricingLabel'] = GetLang('ProductCallForPricingDefault');
         // Get the brands as select options
         $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
         $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions();
         $GLOBALS['CustomFieldKey'] = 0;
         $GLOBALS['CustomFieldName'] = '';
         $GLOBALS['CustomFieldValue'] = '';
         $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField'));
         $GLOBALS['HideCustomFieldDelete'] = 'none';
         $GLOBALS['CustomFields'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields');
         $GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect();
         $GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"';
     }
     $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0);
     # Used to clear the HTML Editor image upload folder name Baskaran
     $_SESSION['congobrand'] = '';
     $_SESSION['congoseries'] = '';
     if (!gzte11(ISC_HUGEPRINT)) {
         $GLOBALS['HideVendorOption'] = 'display: none';
     } else {
         $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
         if (isset($vendorData['vendorid'])) {
             $GLOBALS['HideVendorSelect'] = 'display: none';
             $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']);
             $_SESSION['congobrand'] = $vendorData['vendorid'];
         } else {
             $GLOBALS['HideVendorLabel'] = 'display: none';
             if ($PreservePost) {
                 $GLOBALS['VendorList'] = $this->BuildVendorSelect($_POST['vendor']);
                 $_SESSION['congobrand'] = $_POST['vendor'];
             } else {
                 $GLOBALS['VendorList'] = $this->BuildVendorSelect();
             }
         }
     }
     // Does this store have any categories?
     if (isset($GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->catsById) && count($GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->catsById) == 0) {
         $GLOBALS['NoCategoriesJS'] = 'true';
     }
     $GLOBALS['FormType'] = "AddingProduct";
     $GLOBALS['FormAction'] = "addProduct2";
     $GLOBALS['Title'] = GetLang('AddProductTitle');
     $GLOBALS['Intro'] = GetLang('AddProductIntro');
     $GLOBALS['ProductWeightHelp'] = sprintf(GetLang('ProductWeightHelp'), GetConfig('WeightMeasurement'));
     $GLOBALS['ProductWidthHelp'] = sprintf(GetLang('ProductWidthHelp'), isc_strtolower(GetConfig('LengthMeasurement')));
     $GLOBALS['ProductHeightHelp'] = sprintf(GetLang('ProductHeightHelp'), isc_strtolower(GetConfig('LengthMeasurement')));
     $GLOBALS['ProductDepthHelp'] = sprintf(GetLang('ProductDepthHelp'), isc_strtolower(GetConfig('LengthMeasurement')));
     $GLOBALS['HideMoreImages'] = "none";
     $GLOBALS['HideMoreInsImages'] = "none";
     $GLOBALS['CurrentTab'] = 0;
     if (GetConfig('PricesIncludeTax')) {
         $GLOBALS['PriceMsg'] = GetLang('IncTax');
     } else {
         $GLOBALS['PriceMsg'] = GetLang('ExTax');
     }
     if ($this->HasGD()) {
         $GLOBALS['ShowGDThumb'] = "";
         $GLOBALS['ShowNoGDThumb'] = "none";
     } else {
         $GLOBALS['ShowGDThumb'] = "none";
         $GLOBALS['ShowNoGDThumb'] = "";
     }
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['HideInventoryOptions'] = "none";
     } else {
         $GLOBALS['HideInventoryOptions'] = '';
     }
     $GLOBALS['ISC_LANG']['MaxUploadSize'] = sprintf(GetLang('MaxUploadSize'), GetMaxUploadSize());
     if (isset($_REQUEST['productHash'])) {
         // Get a list of any downloads associated with this product
         $GLOBALS['DownloadsGrid'] = $this->GetDownloadsGrid(0, $_REQUEST['productHash']);
         if ($GLOBALS['DownloadsGrid'] == '') {
             $GLOBALS['DisplayDownloaadGrid'] = "none";
             $GLOBALS['DisplayDownloadUploadGap'] = 'none';
         }
         $GLOBALS['ProductHash'] = $_REQUEST['productHash'];
     } else {
         $GLOBALS['DisplayDownloaadGrid'] = "none";
         $GLOBALS['DisplayDownloadUploadGap'] = 'none';
         $GLOBALS['ProductHash'] = md5(time() . uniqid(rand(), true));
     }
     // Get a list of all layout files
     $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html");
     // By default we have no variation selected
     $GLOBALS['IsNoVariation'] = 'checked="checked"';
     $GLOBALS['HideVariationList'] = "none";
     // If there are no variations then disable the option to choose one
     $numVariations = 0;
     $GLOBALS['VariationOptions'] = $this->GetVariationsAsOptions($numVariations);
     if ($numVariations == 0) {
         $GLOBALS['VariationDisabled'] = "DISABLED";
         $GLOBALS['VariationColor'] = "#CACACA";
     }
     // By default we set variations to NO
     $GLOBALS['IsNoVariation'] = 'checked="checked"';
     // By default we set product options required to YES
     $GLOBALS['OptionsRequired'] = 'checked="checked"';
     // Display the discount rules
     $GLOBALS['DiscountRules'] = $this->GetDiscountRules(0);
     $GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault');
     // Hide if we are not enabled
     if (!GetConfig('BulkDiscountEnabled')) {
         $GLOBALS['HideDiscountRulesWarningBox'] = '';
         $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning');
         $GLOBALS['DiscountRulesWithWarning'] = 'none';
         // Also hide it if this product has variations
     } else {
         if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) {
             $GLOBALS['HideDiscountRulesWarningBox'] = '';
             $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning');
             $GLOBALS['DiscountRulesWithWarning'] = 'none';
         } else {
             $GLOBALS['HideDiscountRulesWarningBox'] = 'none';
             $GLOBALS['DiscountRulesWithWarning'] = '';
         }
     }
     $GLOBALS['DiscountRulesEnabled'] = (int) GetConfig('BulkDiscountEnabled');
     if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Create_Category)) {
         $GLOBALS['HideCategoryCreation'] = 'display: none';
     }
     $GLOBALS['columncount'] = 1;
     $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother');
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("product.form");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Пример #26
0
	protected function printEditor($record = array())
	{
		$user               = IEM::userGetCurrent();
		$group              = new record_UserGroups($record);
		$permissionList     = $user->getProcessedPermissionList();
		$availableLists     = $user->GetLists();
		$availableSegments  = $user->GetSegmentList();
		$availableTemplates = $user->GetTemplates();
		$requestToken       = md5(mt_rand());

		$page = array(
			'messages' => GetFlashMessages()
		);

		IEM::sessionSet('UsersGroups_Editor_RequestToken', $requestToken);

		if (!isset($record['permissions']) || !is_array($record['permissions'])) {
			$record['permissions'] = array();
		}

		if (!isset($record['access']) || !is_array($record['access'])) {
			$record['access'] = array();
		}

		$record['permissions_stupid_template'] = array();
		
		if (isset($record['permissions'])) {
			foreach ($record['permissions'] as $key => $value) {
				foreach ($value as $each) {
					$record['permissions_stupid_template'][] = "{$key}.{$each}";
				}
			}
		}
		
		$this->PrintHeader();
		
		$tpl = GetTemplateSystem();
		$tpl->Assign('PAGE', $page);
		$tpl->Assign('record', $record);
		$tpl->Assign('permissionList', $permissionList);
		$tpl->Assign('isSystemAdmin', $group->isAdmin());
		$tpl->Assign('isLastAdminWithUsers', $group->isLastAdminWithUsers());
		$tpl->Assign('availableLists', $availableLists, true);
		$tpl->Assign('availableSegments', $availableSegments, true);
		$tpl->Assign('availableTemplates', $availableTemplates, true);
		$tpl->Assign('requestToken', $requestToken);

		$tpl->ParseTemplate('UsersGroups_Form');

		$this->PrintFooter();

		return;
	}
Пример #27
0
	/**
	* PrintManageUsers
	* Prints a list of users to manage. If you are only allowed to manage your own account, only shows your account in the list. This allows you to edit, delete and so on.
	*
	* @see GetApi
	* @see GetPerPage
	* @see GetSortDetails
	* @see User_API::Admin
	* @see GetUsers
	* @see SetupPaging
	*
	* @return Void Prints out the list, doesn't return anything.
	*/
	function PrintManageUsers()
	{
		// ----- Sanitize and declare variables that is going to be used in this function
			$pageRecordPP		= 0;
			$pageCurrentIndex	= $this->GetCurrentPage();
			$pageSortInfo		= $this->GetSortDetails();

			$requestPreserveQuickSearch	= IEM::requestGetGET('PreserveQuickSearch', 0, 'intval');
			$requestSearch				= IEM::requestGetPOST('QuickSearchString', false);
			$requestGroupID				= IEM::requestGetGET('GroupID', 0, 'intval');

			$records			= array();
			$recordTotal		= 0;

			$api				= $this->GetApi('User');

			$currentUser		= IEM::getCurrentUser();

			$page = array(
				'messages'		=> GetFlashMessages(),
				'userreport'	=> '',
				'currentuserid'	=> $currentUser->userid
			);

			$permissions = array(
				'admin'				=> $currentUser->UserAdmin()
			);

			$groupInformation = array();
		// -----

		// Only admin/user admin able to view these pages
		if (!$currentUser->isAdmin()) {
			$this->DenyAccess();
		}

		$temp = ssk23twgezm2();
		if (is_array($temp) && isset($temp['message'])) {
			$page['userreport'] = $temp['message'];
		}

		if ($requestSearch === false && $requestPreserveQuickSearch) {
			$requestSearch = IEM::sessionGet('Users_Manage_QuickSearchString', '');
		} else {
			$requestSearch = trim($requestSearch);
			IEM::sessionSet('Users_Manage_QuickSearchString', $requestSearch);
		}

		// ----- Get "Record Per Page"
			if ($pageRecordPP == 0) {
				$pageRecordPP = $this->GetPerPage();
			}
		// -----

		$start = 0;
		if ($pageRecordPP != 'all') {
			$start = ($pageCurrentIndex - 1) * $pageRecordPP;
		}

		$recordTotal = $api->GetUsers(0, $pageSortInfo, true, $start, $pageRecordPP, $requestSearch, $requestGroupID);
		$records = $api->GetUsers(0, $pageSortInfo, false, $start, $pageRecordPP, $requestSearch, $requestGroupID);

		if (!empty($requestGroupID)) {
			$groupInformation = API_USERGROUPS::getRecordByID($requestGroupID);
		}

		for ($i = 0, $j = count($records); $i < $j; ++$i) {
			$records[$i]['processed_CreateDate'] = $this->PrintDate($records[$i]['createdate']);
			$records[$i]['processed_LastLoggedIn'] = ($records[$i]['lastloggedin'] ? $this->PrintDate($records[$i]['lastloggedin']) : '-');
		}

		// ----- Calculate pagination, this is using the older method of pagination
			$GLOBALS['PAGE'] = 'Users&PreserveQuickSearch=1' . (!empty($requestGroupID) ? "&GroupID={$requestGroupID}" : '');
			$GLOBALS['FormAction'] = 'Action=ProcessPaging&PreserveQuickSearch=1' . (!empty($requestGroupID) ? "&GroupID={$requestGroupID}" : '');

			$this->SetupPaging($recordTotal, $pageCurrentIndex, $pageRecordPP);
		// -----

		// ----- Print out HTML
			$tpl = GetTemplateSystem();
			$tpl->Assign('PAGE', $page);
			$tpl->Assign('records', $records);
			$tpl->Assign('permissions', $permissions);
			$tpl->Assign('quicksearchstring', $requestSearch);
			$tpl->Assign('groupInformation', $groupInformation);

			echo $tpl->ParseTemplate('Users', true);
		// -----

		return;
	}
Пример #28
0
 public function Admin_Action_Default()
 {
     $db = IEM::getDatabase();
     $api = $this->GetApi();
     //$api->get_random_url();
     $r = $api->url_details();
     //($r);die;
     $this->template_system->Assign('FlashMessages', GetFlashMessages(), false);
     $this->template_system->assign('result', $r);
     $this->template_system->ParseTemplate('main');
 }
Пример #29
0
/**
 * Retrieve pre-built message boxes for all of the current flash messages.
 *
 * @return string The built message boxes.
 */
function GetFlashMessageBoxes()
{
    $flashMessages = GetFlashMessages();
    $messageBoxes = '';
    if (is_array($flashMessages)) {
        foreach ($flashMessages as $flashMessage) {
            $messageBoxes .= MessageBox($flashMessage['message'], $flashMessage['type']);
        }
    }
    return $messageBoxes;
}
Пример #30
0
 /**
  * EditSchedule
  * This prints out the "edit schedule" page
  * which in reality isn't much different to a normal edit schedule page except:
  * - list multiple campaigns (each name being clickable to show a preview of that campaign)
  *
  * The data passed in contains the "jobdetails" array from the job being edited.
  * That array contains the splitid - which can then be used to work out the campaigns etc being used.
  *
  * If it's not a 'splittest' job type, this function/method just returns and doesn't do anything.
  *
  * @param EventData_IEM_SCHEDULE_EDITJOB $data The array of jobdetails for the scheduled event being edited.
  *
  * @uses InterspireEventData::preventDefault
  * @uses User_API::GetLists
  * @uses User_API::GetSegmentList
  * @uses SendStudio_Functions::CreateDateTimeBox
  */
 public static function EditSchedule(EventData_IEM_SCHEDULE_EDITJOB $data)
 {
     $jobinfo =& $data->jobrecord;
     if (empty($jobinfo) || !isset($jobinfo['jobtype'])) {
         FlashMessage(GetLang('Addon_splittest_Schedule_JobInvalid'), SS_FLASH_MSG_ERROR, self::application_url . 'index.php?Page=Schedule');
         return;
     }
     if ($jobinfo['jobtype'] != 'splittest') {
         return;
     }
     $data->preventDefault();
     $self = new self();
     $user = GetUser();
     $splitid = $jobinfo['jobdetails']['splitid'];
     /**
      * Check for messages.
      * If there are no flash messages, maybe it's being set in the "GLOBALS[Message]" string instead
      * by the admin/functions/schedule.php file.
      * Check that too :)
      */
     $flash_messages = GetFlashMessages();
     if (isset($GLOBALS['Message'])) {
         $flash_messages .= $GLOBALS['Message'];
     }
     $self->template_system->Assign('FlashMessages', $flash_messages, false);
     $self->template_system->Assign('Jobid', $jobinfo['jobid']);
     require_once SENDSTUDIO_API_DIRECTORY . '/newsletters.php';
     require_once SENDSTUDIO_API_DIRECTORY . '/jobs.php';
     require_once SENDSTUDIO_API_DIRECTORY . '/stats.php';
     $job_api = new Jobs_API();
     $stats_api = new Stats_API();
     $news_api = new Newsletters_API();
     $splitapi = $self->GetApi();
     $splitdetails = $splitapi->Load($splitid);
     $sendtype = $jobinfo['jobdetails']['sendingto']['sendtype'];
     $sending_to = $jobinfo['jobdetails']['sendingto']['sendids'];
     $sendinglist = array();
     if ($sendtype == 'list') {
         $user_lists = $user->GetLists();
         foreach ($sending_to as $listid) {
             $sendinglist[$listid] = htmlspecialchars($user_lists[$listid]['name'], ENT_QUOTES, SENDSTUDIO_CHARSET);
         }
     }
     if ($sendtype == 'segment') {
         $user_segments = $user->GetSegmentList();
         foreach ($sending_to as $segmentid) {
             $sendinglist[$segmentid] = htmlspecialchars($user_segments[$segmentid]['segmentname'], ENT_QUOTES, SENDSTUDIO_CHARSET);
         }
     }
     /**
      * Get the sendstudio functions file to create the date/time box.
      */
     require_once SENDSTUDIO_FUNCTION_DIRECTORY . '/sendstudio_functions.php';
     /**
      * also need to load the 'send' language file so it can put in the names/descriptions.
      */
     require_once SENDSTUDIO_LANGUAGE_DIRECTORY . '/default/send.php';
     $ssf = new SendStudio_Functions();
     $timebox = $ssf->CreateDateTimeBox($jobinfo['jobtime'], false, 'datetime', true);
     $self->template_system->Assign('ApplicationUrl', $self->application_url, false);
     $self->template_system->Assign('ScheduleTimeBox', $timebox, false);
     $self->template_system->Assign('SendType', $sendtype);
     $self->template_system->Assign('campaigns', $splitdetails['splittest_campaigns']);
     $self->template_system->Assign('sendinglist', $sendinglist);
     $self->template_system->ParseTemplate('schedule_edit');
 }