function setupThumbs($filedef, $imagedef)
 {
     $path_helper = new PathHelper();
     foreach ($imagedef['thumbs'] as &$thumb) {
         $thumb[1] = $path_helper->join(array($imagedef['base_dir'], $thumb[1], $filedef['filename']), '/');
     }
     if ($imagedef['admin_dir'] !== false) {
         #For the list
         $path_1 = $path_helper->join(array('{public}/' . DEFAULT_MODULE . '/admin', $imagedef['admin_dir'], 'small', $filedef['value']), '/');
         $admin_thumb_1 = array('crop', $path_1, 30, 30);
         $imagedef['thumbs'][] = $admin_thumb_1;
         #For the gallery
         $path_2 = $path_helper->join(array('{public}/' . DEFAULT_MODULE . '/admin', $imagedef['admin_dir'], $filedef['value']), '/');
         $admin_thumb_2 = array('filled', $path_2, 160);
         $imagedef['thumbs'][] = $admin_thumb_2;
     }
     $thumbs = $imagedef['thumbs'];
     if ($thumbs) {
         $last = $thumbs[count($thumbs) - 1];
         $parts = explode('/', $last[1]);
         $dir = implode('/', array_slice($parts, 3, count($parts) - 4));
         $this->setBasePath(UrlHelper::resource('/' . DEFAULT_MODULE . '/admin/' . $dir));
     }
     $this->setThumbsTarget($thumbs);
 }
 function post()
 {
     $blog_post_id = $this->node->arg('blog_post_id');
     $values = array();
     $form = $this->components->add('form', array('back' => $this->db->from('blog_post')->select('title')));
     $author_id = $this->db->from('blog_author')->select('blog_author_id')->where('user_id', $this->plugin->Auth->get('user_id'))->fetchScalar();
     $blog_post = $form->addTable('blog_post', array('title' => array('validator' => $this->valid->get('required', 'no_html')), 'content' => array('validator' => $this->valid->required), 'blog_author_id' => array('value' => $author_id), 'blog_id' => array('value' => $this->node->arg('blog_id')), 'pub_date' => array('value' => date('Y-m-d H:i:s')), 'summary' => array('validator' => $this->valid->required), 'status' => array('validator' => $this->valid->required), 'blog_category_id' => array('type' => 'dropdown', 'validator' => $this->valid->required)));
     $plugins = $blog_post->content->getConfigOption('plugins');
     $blog_post->content->setConfigOption('plugins', $plugins . ',table,pagebreak,markettoimages');
     $blog_post->content->setConfigOption('pagebreak_separator', '<!-- Break -->');
     $blog_post->content->setConfigOption('height', 600);
     $blog_post->content->setConfigOption('theme_advanced_blockformats', "p,pre,h1,h2,h3,h4,blockquote,code");
     $blog_post->content->setConfigOption('content_css', UrlHelper::resource('/blog/tinymce.css'));
     $blog_post->content->setConfigOption('theme_advanced_buttons1_add', 'pagebreak,markettoimages');
     $blog_post->content->setConfigOption('theme_advanced_buttons2', 'tablecontrols');
     $blog_post->content->setConfigOption('valid_elements', '*[*]');
     $blog_post->content->filter_html = false;
     $blog_post->blog_category_id->setDataSource($this->db->from('blog_category')->select('blog_category_id', 'name')->where('blog_id', $this->node->arg('blog_id'))->orderby('name', 'asc'));
     $blog_post->blog_category_id->add('', $this->lang->categories['select']);
     $blog_post->status->setDataSource($this->lang->status);
     $blog_post_tag = $form->addTable('blog_post_tag', array('blog_tag_id' => array('type' => '/blog/taglist')), array('keys' => array('blog_post_id' => $blog_post), 'delete' => array('blog_post_id' => $blog_post), 'multirow' => true, 'multicolumn' => true));
     $blog_post_tag->blog_post_id->setReference($blog_post->blog_post_id, true);
     $blog_post_tag->blog_tag_id->setNote($this->lang->fields['separated']);
     if ($blog_post_id) {
         $values = $this->db->from('blog_post')->where('blog_post_id', $blog_post_id)->fetchRow();
         $form->setValues($blog_post, $values);
         $values = $this->db->from('blog_post_tag')->select('blog_tag_id')->where('blog_post_id', $blog_post_id)->fetchArray();
         $form->setValues($blog_post_tag, array('blog_tag_id' => $values));
     }
 }
 function uploadImage()
 {
     $form = $this->load->form('/phaxsi/form', $_POST);
     $image = $form->add('fileimage', 'userfile');
     $filenames = $image->createThumbs(array($_POST['thumb'], '{uploads[' . DEFAULT_MODULE . ']}/images/{random}.{ext}', $_POST['width'], $_POST['height']));
     if ($filenames) {
         //Uploads?
         $filename = UrlHelper::resource(str_replace(APPD_PUBLIC, '', $filenames[0]));
         $this->view->set('result', $filename);
         $this->view->set('resultcode', 'ok');
         $this->view->set('file_name', $filename);
     } else {
         $this->view->set('result', 'Upload failed');
         $this->view->set('resultcode', 'failed');
         $this->view->set('file_name', '');
     }
 }
 function __toString()
 {
     $this->setAttribute('src', UrlHelper::resource($this->src));
     return parent::__toString();
 }
Esempio n. 5
0
		<?php 
    foreach ($datasource as $data) {
        ?>

			<li style="<?php 
        echo $i % 5 == 0 && !isset($operations['order']) ? "clear:both" : "";
        ?>
" class="ui-state-default" data-id="<?php 
        echo $data[0];
        ?>
">

				<div class="picture">

					<?php 
        $img = $html->absoluteImg(UrlHelper::resource('admin/' . $image_base . '/' . $data[1]), $data[1], array('width' => 160, 'height' => 160));
        ?>

					<?php 
        if (isset($operations['view']) && $operations['view'] != null) {
            ?>
						
					<?php 
        } elseif (isset($operations['edit'])) {
            ?>

						<?php 
            echo $html->langLink($img, '/admin/' . $data['_url_edit'], null, false);
            ?>
						<?php 
            if (isset($data[2])) {
Esempio n. 6
0
 static function publicLink($text, $href, $attributes = array(), $escape = true)
 {
     return self::absoluteLink($text, UrlHelper::resource($href), $attributes, $escape);
 }
Esempio n. 7
0
 protected function getHeadHtml()
 {
     $html = new HtmlHelper($this->context);
     $output = '';
     foreach ($this->metas as $meta) {
         if ($meta['name']) {
             $output .= "<meta name=\"{$meta['name']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
         } elseif ($meta['http-equiv']) {
             $output .= "<meta http-equiv=\"{$meta['http-equiv']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
         }
     }
     $output .= "<title>" . HtmlHelper::escape($this->title) . "</title>\r\n";
     $output .= '<base href="' . UrlHelper::get('/') . '"/>' . "\r\n";
     if ($this->favico) {
         $output .= '<link rel="icon" type="' . $this->favico[1] . "\" href=\"" . UrlHelper::resource($this->favico[0]) . "\">\r\n";
     }
     if ($this->description) {
         $output .= '<meta name="description" content="' . HtmlHelper::escape($this->description) . "\" />\r\n";
     }
     if ($this->keywords) {
         $output .= '<meta name="keywords" content="' . HtmlHelper::escape($this->keywords) . "\" />\r\n";
     }
     foreach ($this->feeds as $feed) {
         $output .= '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . UrlHelper::get($feed) . "\" />\r\n";
     }
     foreach ($this->styles as $style) {
         $output .= $html->css($style[0], $style[1]) . "\r\n";
     }
     if ($this->js_library) {
         $output .= "<script type=\"text/javascript\" src=\"{$this->js_library}\"></script>\r\n";
         $output .= $html->javascript('/' . APPU_PHAXSI . '/' . 'phaxsi-' . PhaxsiConfig::FRAMEWORK_VERSION . (AppConfig::DEBUG_MODE ? '' : '.min') . '.js') . "\r\n";
         $output .= HtmlHelper::inlineJavascript("Phaxsi.path = {" . "base: '" . UrlHelper::get('') . "'," . "local: '" . UrlHelper::localized('/') . "'," . "'public': '" . APPU_PUBLIC . "'," . "lang: '" . Lang::getCurrent() . "'}");
     }
     foreach ($this->scripts as $script) {
         $output .= $html->javascript($script) . "\r\n";
     }
     $this->styles = $this->scripts = array();
     return $output;
 }
 function __construct($initial_value = '', $name = null)
 {
     parent::__construct('textarea', $initial_value, $name, true);
     $this->setValidator(array());
     $this->config = array('mode' => 'exact', 'elements' => $this->getId(), 'theme' => 'advanced', 'theme_advanced_buttons1' => 'bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,image,markettoimages,media,separator,bullist,formatselect,forecolor,backcolor,emotions,code', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => '', 'relative_urls' => false, 'height' => '250', 'verify_html' => true, 'cleanup' => true, 'document_base_url' => UrlHelper::get('/'), 'plugins' => 'advimage,media,emotions,paste', 'content_css' => UrlHelper::resource('/phaxsi/extensions/tinycss.css'), 'theme_advanced_statusbar_location' => 'bottom', 'theme_advanced_resizing' => true, 'theme_advanced_resize_horizontal' => false, 'theme_advanced_toolbar_location' => 'top');
 }