Ejemplo n.º 1
0
 protected function _handleInput()
 {
     if ($this->autodetect) {
         $this->current = Project_Navigator::getNavPoint(Server::get('REQUEST_URL'));
     } elseif ($this->current !== null) {
         Project_Navigator::get($this->current);
     }
     // check if registered
 }
    protected function getResubscriptionHtml($urlBase, $client)
    {
        $nav = new Project_Navigator();
        $code = $client ? $client['Code'] : 'XXXXXXXXXXXXXXXX';
        $resubscriptionLink = $urlBase . $nav->get('newsletters_resubscription') . '?code=' . urlencode($code);
        return <<<EOT
<p>You can confirm your subscription for our newsletters service by clicking on <a href="{$resubscriptionLink}">this link</a>.</p>
EOT;
    }
 protected function _handleRedirection()
 {
     if ($this->_redirection !== null) {
         if ($this->navpoint !== null && $this->navpoint !== '') {
             $navigator = new Project_Navigator();
             $to = $navigator->get($this->navpoint);
         } else {
             $to = $this->target;
         }
         if ($this->qs !== null) {
             if ($this->qs[0] !== '?') {
                 $to .= '?';
             }
             $to .= $this->qs;
         }
         Redirection::redirectPage($to, $this->code, $this->schema, $this->host);
     }
 }
 protected static function getImageNotFound()
 {
     return Project_Navigator::get('image_not_found');
 }
 protected function updateTemplate_Picture(Var_Pool $picture, $directory = '')
 {
     $vars = array('ma_vlastni_obrazek', 'nema_vlastni_obrazek', 'vlastni_obrazek', 'vlastni_obrazek_jako_link', 'puvodni_vlastni_obrazek', 'puvodni_vlastni_obrazek_jako_link', 'nahradni_obrazek_vzor', 'nahradni_obrazek', 'tag_obrazku');
     foreach ($vars as $varname) {
         ${$varname} = $this->_index->{$varname};
     }
     $vlastni_obrazek_val = $picture->GPFileName !== '' ? "{$directory}/{$picture->GPFileName}" : $picture->FileName;
     $puvodni_vlastni_obrazek_val = $picture->FileName;
     $nadpis_val = $picture->GPTitle !== '' ? $picture->GPTitle : $picture->Title;
     $puvodni_nadpis_val = $picture->Title;
     foreach ($ma_vlastni_obrazek as $elem) {
         $elem->active = $vlastni_obrazek_val !== '';
     }
     foreach ($nema_vlastni_obrazek as $elem) {
         $elem->active = $vlastni_obrazek_val === '';
     }
     $pnav = new Project_Navigator();
     $galleries_directory = $pnav->images_dir . $pnav->get('galleries_dir', true);
     if ($vlastni_obrazek_val === '') {
         $img = clone $nahradni_obrazek_vzor[0];
         $thumb = $this->getThumbnailFileName($img->src, $this->thumbs);
         $img->src = $galleries_directory . $thumb;
         $img->alt = basename($thumb);
         foreach ($nahradni_obrazek as $elem) {
             $elem->add($img);
         }
     } elseif (!empty($vlastni_obrazek_jako_link) || !empty($vlastni_obrazek)) {
         if (!empty($obrazek_img_vzor)) {
             $img = clone $obrazek_img_vzor[0];
         } else {
             $img = new HTML_Img();
         }
         $thumb = $this->getThumbnailFileName($vlastni_obrazek_val, $this->thumbs);
         $img->src = $galleries_directory . $thumb;
         $img->alt = basename($thumb);
         if (!empty($obrazek_a_vzor)) {
             $a = clone $obrazek_a_vzor[0];
             $a->clear();
         } else {
             $a = new HTML_A();
         }
         $a->href = $galleries_directory . $vlastni_obrazek_val;
         $a->title = $nadpis_val;
         Images_JS_Support::updateElement($this->images, $a);
         $a->add($img);
         foreach ($vlastni_obrazek_jako_link as $elem) {
             $elem->clear();
             $elem->add($a);
         }
         foreach ($vlastni_obrazek as $elem) {
             $elem->clear();
             $elem->add($img);
         }
     }
     if ($puvodni_vlastni_obrazek_val !== '' && (!empty($puvodni_vlastni_obrazek_jako_link) || !empty($puvodni_vlastni_obrazek))) {
         $img = new HTML_Img();
         $thumb = $this->getThumbnailFileName($puvodni_vlastni_obrazek_val, $this->thumbs);
         $img->src = $galleries_directory . $thumb;
         $img->alt = basename($thumb);
         $a = new HTML_A();
         $a->href = $galleries_directory . $puvodni_vlastni_obrazek_val;
         $a->title = $puvodni_nadpis_val;
         Images_JS_Support::updateElement($this->images, $a);
         $a->add($img);
     }
     foreach ($puvodni_vlastni_obrazek_jako_link as $elem) {
         $elem->add($a);
     }
     foreach ($puvodni_vlastni_obrazek_jako_link as $elem) {
         $elem->add($img);
     }
     $this->updateTemplate_PictureTitles($picture);
     $this->updateTemplate_PictureDescriptions($picture);
     $this->updateTemplate_PictureAuthors($picture);
     $this->updateTemplate_PictureDate($picture);
 }
Ejemplo n.º 6
0
 public static function redirectNavPoint($nav_point, $code = 303, $schema = null)
 {
     $navigator = new Project_Navigator();
     $to = $navigator->get($nav_point);
     self::redirectPage($to, $code, $schema);
 }
Ejemplo n.º 7
0
 protected function updateTemplate_Attachments(HTML_Indexer $index = null, Kiwi_Product $product_data = null)
 {
     if ($index === null) {
         $index = $this->_index;
     }
     if ($product_data === null) {
         $product_data = $this->_product_data;
     }
     $vars = array('priloha_vzor', 'priloha_odkaz', 'priloha_nazev', 'priloha_pripona', 'ma_prilohy', 'nema_prilohy', 'prilohy');
     foreach ($vars as $varname) {
         ${$varname} = $index->{$varname};
     }
     $attachments = $product_data->attachments;
     foreach ($ma_prilohy as $elem) {
         $elem->active = !empty($attachments);
     }
     foreach ($nema_prilohy as $elem) {
         $elem->active = empty($attachments);
     }
     if (!empty($prilohy)) {
         if (empty($priloha_vzor)) {
             throw new Template_Element_Missing_Exception('priloha_vzor');
         }
         if (count($priloha_vzor) !== 1) {
             throw new Template_Invalid_Structure_Exception('The "priloha_vzor" element duplicity');
         }
         $priloha_vzor = $priloha_vzor[0];
         if (!empty($attachments)) {
             $nav = new Project_Navigator();
             $attachments_dir = $nav->get($this->name . '_attachments');
             foreach ($attachments as $attachment) {
                 $file = $attachments_dir . $attachment['FileName'];
                 foreach ($priloha_odkaz as $elem) {
                     $elem->href = $file;
                 }
                 foreach ($priloha_nazev as $elem) {
                     $elem->clear();
                     $elem->add(new HTML_Text($attachment['Title']));
                 }
                 $path_parts = pathinfo($attachment['FileName']);
                 $ext = $path_parts['extension'];
                 $found = 0;
                 foreach ($priloha_pripona as $elem) {
                     if ($elem->active = $elem->specification === strtolower($ext)) {
                         $found += 1;
                     }
                 }
                 if ($found === 0) {
                     foreach ($priloha_pripona as $elem) {
                         $elem->active = $elem->specification === 'default';
                     }
                 }
                 $attachment_elem = clone $priloha_vzor;
                 foreach ($prilohy as $elem) {
                     $elem->add($attachment_elem);
                 }
             }
         }
     }
 }