Пример #1
0
 function __toString()
 {
     $label = $this->getLabel();
     if (is_array($label)) {
         $label = array_map('strip_tags', $label);
         $label = implode(' ', $label);
     }
     $tmplates = Am_Di::getInstance()->emailTemplateTable->findByName($this->getName(), null, null, 'days');
     $out = '';
     $delUrl = REL_ROOT_URL . '/admin-email-templates/delete/?';
     $editUrl = REL_ROOT_URL . '/admin-email-templates/edit-pending-notification-rule?';
     foreach ($tmplates as $t) {
         $p = array('id' => $t->email_template_id, 'b' => $_SERVER['REQUEST_URI'] . '#' . $this->getName(), 'label' => $label, 'name' => $this->getName());
         $out .= '<div style="padding-bottom:0.4em">&ndash; ' . $this->renderRule($t) . ' [<a class="email-template local" href="' . $editUrl . http_build_query($p, '', '&') . '">Edit</a>] [<a class="email-template-del local" href="' . $delUrl . http_build_query($p, '', '&') . '">Delete</a>]</div>';
     }
     $url = REL_ROOT_URL . '/admin-email-templates/add-pending-notification-rule/?';
     $params = array('name' => Am_Form_Setup::name2dots($this->getName()), 'b' => $_SERVER['REQUEST_URI'] . '#' . $this->getName(), 'label' => $label);
     if ($out) {
         $out .= '<br />';
     }
     $out = sprintf('<a name="%s"></a><div>%s<div><a href="%s" class="email-template local">%s</a></div></div>', $this->getName(), $out, $url . http_build_query($params, '', '&'), ___('Add New Notification Rule'));
     return $out;
 }
Пример #2
0
 public function preDispatch()
 {
     $vars = $this->_request->toArray();
     foreach ($vars as $k => $v) {
         $kk = Am_Form_Setup::name2dots($k);
         if ($kk != $k) {
             unset($vars[$k]);
             $vars[$kk] = $v;
         }
     }
     $this->_request->setParams($vars);
 }
Пример #3
0
 public static function getEditLink($el, $day = null, $product_id = null)
 {
     $label = $el->getLabel();
     if (is_array($label)) {
         $label = array_map('strip_tags', $label);
         $label = implode(' ', $label);
     }
     $url = REL_ROOT_URL . sprintf('/admin-email-templates/edit/?name=%s&b=%s', Am_Form_Setup::name2dots($el->getName()), rawurlencode($_SERVER['REQUEST_URI'] . '#' . $el->getName()));
     if (!is_null($day)) {
         $url .= sprintf('&day=%d', $day);
     }
     if (!is_null($product_id)) {
         $url .= sprintf('&product_id=%d', $product_id);
     }
     $url .= sprintf('&label=%s', rawurlencode($label));
     return sprintf('<a href="%s" class="email-template">%s</a>', $url, ___('Edit E-Mail Template'));
 }