Example #1
0
 /**
  * Get a valid image URL to use from BackOffice
  *
  * @param string $image Image name
  * @param boolean $entites Set to true to use htmlentities function on image param
  */
 public static function getAdminImageUrl($image = null, $entities = false)
 {
     return Tools::getAdminUrl(basename(_PS_IMG_DIR_) . '/' . $image, $entities);
 }
 protected function displayMessage($message, $email = false, $id_employee = null)
 {
     $tpl = $this->createTemplate('message.tpl');
     $contacts = Contact::getContacts($this->context->language->id);
     foreach ($contacts as $contact) {
         $contact_array[$contact['id_contact']] = array('id_contact' => $contact['id_contact'], 'name' => $contact['name']);
     }
     $contacts = $contact_array;
     if (!$email) {
         if (!empty($message['id_product']) && empty($message['employee_name'])) {
             $id_order_product = Order::getIdOrderProduct((int) $message['id_customer'], (int) $message['id_product']);
         }
     }
     $message['date_add'] = Tools::displayDate($message['date_add'], null, true);
     $message['user_agent'] = strip_tags($message['user_agent']);
     $message['message'] = preg_replace('/(https?:\\/\\/[a-z0-9#%&_=\\(\\)\\.\\? \\+\\-@\\/]{6,1000})([\\s\\n<])/Uui', '<a href="\\1">\\1</a>\\2', html_entity_decode($message['message'], ENT_QUOTES, 'UTF-8'));
     $is_valid_order_id = true;
     $order = new Order((int) $message['id_order']);
     if (!Validate::isLoadedObject($order)) {
         $is_valid_order_id = false;
     }
     $tpl->assign(array('thread_url' => Tools::getAdminUrl(basename(_PS_ADMIN_DIR_) . '/' . $this->context->link->getAdminLink('AdminCustomerThreads') . '&amp;id_customer_thread=' . (int) $message['id_customer_thread'] . '&amp;viewcustomer_thread=1'), 'link' => Context::getContext()->link, 'current' => self::$currentIndex, 'token' => $this->token, 'message' => $message, 'id_order_product' => isset($id_order_product) ? $id_order_product : null, 'email' => $email, 'id_employee' => $id_employee, 'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'), 'file_name' => file_exists(_PS_UPLOAD_DIR_ . $message['file_name']), 'contacts' => $contacts, 'is_valid_order_id' => $is_valid_order_id));
     return $tpl->fetch();
 }
Example #3
0
 /**
  * Create the reminder to schedule the cron
  */
 public function renderReminder($display_panel = true)
 {
     $this->context->smarty->assign('display_panel', (bool) $display_panel);
     $this->context->smarty->assign('cron_cli', _PS_MODULE_DIR_ . $this->name . '/cron.php');
     $this->context->smarty->assign('cron_url', Tools::getAdminUrl('modules/' . $this->name . '/cron.php?' . Configuration::get('AUTOZIP_TOKEN_NAME') . '=' . Configuration::get('AUTOZIP_TOKEN_KEY')));
     return $this->context->smarty->fetch($this->local_path . 'views/templates/admin/configure.tpl');
 }