Example #1
0
 public function render()
 {
     $template = new NFileTemplate();
     $template->registerFilter(new NLatteFilter());
     $template->setFile(dirname(__FILE__) . '/promo.phtml');
     $template->id = 'Multiupload_' . $this->type_module;
     //		$template->css = file_get_contents(dirname(__FILE__).'/fileuploader.css');
     //		$template->js = file_get_contents(dirname(__FILE__).'/fileuploader.js');
     if (_NETTE_MODE) {
         $template->action = NEnvironment::getApplication()->getPresenter()->link('Homepage:upload');
     } else {
         $template->action = '/admin.php';
     }
     $template->parsed_url = $this->parsed_url;
     $template->list = self::getAllFiles($this->type_module, $this->id_module, $this->type);
     foreach ($template->list as $k => $l) {
         $i = dibi::fetch("SELECT title, link, alt, link_name FROM [promo_text] WHERE id_file = %i", $l['id_file']);
         $template->list[$k]['title'] = $i['title'];
         $template->list[$k]['link'] = $i['link'];
         $template->list[$k]['alt'] = $i['alt'];
         $template->list[$k]['link_name'] = $i['link_name'];
     }
     return $template;
 }
Example #2
0
 function createComponent($name)
 {
     switch ($name) {
         /*
          * newsletterTabella
          */
         case 'newsletterTabella':
             $grid = new Tabella(NewsletterModel::getFluent()->toDataSource(), array('sorting' => 'desc', 'order' => 'adddate', 'id_table' => 'id', 'limit' => 100, 'onSuccess' => function ($values) {
                 NewsletterModel::edit($values, $values['id_newsletter_emails']);
             }, 'onDelete' => function ($id_newsletter_emails) {
                 NewsletterModel::delete($id_newsletter_emails);
             }));
             $el = NHtml::el("div");
             $session = NEnvironment::getSession('checked_emails');
             $grid->addColumn($el, "", array("editable" => false, 'filter' => false, "width" => 20, "renderer" => function ($row) use($session) {
                 $el = NHtml::el("td");
                 $checked = isset($session->emails[$row['id_newsletter_emails']]) ? 'checked="checked"' : '';
                 $el->add('<input class="checked_emails" type="checkbox" name="se[]" value="' . $row['id_newsletter_emails'] . '" ' . $checked . '/>');
                 return $el;
             }));
             $grid->addColumn("Id", "id_newsletter_emails", array("width" => 30, 'editable' => false));
             $grid->addColumn("Email", "email", array("width" => 50, 'editable' => false));
             //				$grid->addColumn( "Popis", "description", array( 'editable'=>true ) );
             $grid->addColumn("Dátum registrácie ", "adddate", array("width" => 100));
             /*$grid->addColumn( "Aktívny", "active",
             						array(
             							"width" => 50,
             							'type'=>  Tabella::SELECT,
             							"editable" => true,
             							"filter" => array( 1=>'áno', 0=>'nie'),
             							'renderer' => function($row){
             								$active = ($row['active'] == 1)?'áno':'nie';
             								$el = NHtml::el( "td" )->setHtml($active);
             								return $el;
             							}
             						)
             				);
             
             
             				$grid->addColumn("", "",
             					array(
             						"width" => 30,
             						'filter'=>NULL,
             						"options" => '',
             
             						"renderer" => function( $row ) {
             							$el = NHtml::el( "td" );
             
             							$el->add(
             							NHtml::el( 'a' )->href(
             								NEnvironment::getApplication()->getPresenter()->link( 'deleteEmail!' , array('id'=>$row->id_newsletter_emails))
             							)->addClass( 'deleteIcon' )
             							);
             
             							$span = NHtml::el('span');
             
             
             							$el->add($span);
             
             							return $el;
             						}
             						)
             					);
             */
             $this->addComponent($grid, $name);
             break;
             /*
              * newslette text
              */
         /*
          * newslette text
          */
         case 'newsletterTextForm':
             $last_newsletter = dibi::fetch("SELECT * FROM [newsletter_sended_msg] ORDER BY [date] DESC LIMIT 1");
             $f = new MyForm($this, $name);
             $f->addText('subject', 'Predmet')->addRule(NForm::FILLED, 'Predmet musí byť vyplnený.');
             $f->addTextArea('text', '');
             $f->addText('my_email', 'Testovací email');
             $f->addSubmit('btn_send_emails', 'Odoslať všetkým')->onClick[] = array($this, 'actionSendEmails');
             $f->addSubmit('btn_send_to_me', 'Odoslať testovací email')->onClick[] = array($this, 'actionSendTestingEmail');
             if (!$last_newsletter) {
                 $email_template = new NFileTemplate();
                 $email_template->registerFilter(new NLatteFilter());
                 $email_template->setFile(WWW_DIR . '/newsletter/templates/1/1.phtml');
                 $email_template->text = '';
                 $values['text'] = (string) $email_template;
             } else {
                 $values = $last_newsletter;
             }
             $f->setDefaults($values);
             return $f;
             break;
         case 'addForm':
             $f = new MyForm();
             $f->addText('emails', 'Email');
             $f->addSubmit('btn', 'Pridať');
             $f->onSuccess[] = array($this, 'handleAddEmail');
             return $f;
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
Example #3
0
 function renderImageList()
 {
     $template = new NFileTemplate();
     $template->registerFilter(new NLatteFilter());
     $template->setFile(dirname(__FILE__) . '/imageList.phtml');
     $template->id = 'Multiupload_' . $this->type_module;
     $template->parsed_url = $this->parsed_url;
     $template->list = self::getAllFiles($this->type_module, $this->id_module, $this->type);
     return $template;
 }
Example #4
0
 function render()
 {
     $t = new NFileTemplate();
     $t->setFile(APP_DIR . '/templates/admin/menu/menuLeftHolder.phtml');
     $t->registerFilter(new NLatteFilter());
     $t->var = $this->var;
     $t->menu = $this->getTree();
     return (string) $t;
 }