Esempio n. 1
0
    public static function renderScripts(){
    
    
         if (count(self::$_scripts) == 0)
            return FALSE; 
    

         self::$_scripts = array_unique(self::$_scripts);

           // kohana:: $environment
         if ( kohana::$environment == Kohana::DEVELOPMENT){
    
            foreach (self::$_scripts as $js){
              
                echo HTML::script("media/scripts/".$js);
              
            }
            
         }else{
                                              
            $js = implode( ",", self::$_scripts);
           
            ?><script type="text/javascript" src="<?php 
echo url::base();
?>
min/index.php?b=media/scripts&amp;f=<?php 
echo $js;
?>
"></script><?
                     
         }
                                                                         
    
    }
Esempio n. 2
0
 public function reset_database()
 {
     $this->layout->title = "NOSH ChartingSystem Reset Database";
     $this->layout->style = '';
     $this->layout->script = HTML::script('/js/reset.js');
     $this->layout->content = View::make('reset_database');
 }
Esempio n. 3
0
 /**
  * Add script
  *
  * @param   string  $path
  * @param   string  $group
  */
 public function addScript($path, $group = 'default')
 {
     if (Filesystem::getExtension($path) == 'js') {
         isset($this->scripts->{$group}) or $this->scripts->{$group} = new Core_ArrayObject();
         $this->scripts->{$group}->{$path} = HTML::script(self::preparePath($path));
     }
 }
 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm(0);
     // get list Ad Format
     $AdFormatModel = new AdFormatBaseModel();
     $this->data['listAdFormat'] = $AdFormatModel->getAllForm();
     // get list Type
     $this->data['listAdType'] = Config::get('data.ad_type');
     // get list Wmode
     $this->data['listWmode'] = Config::get('data.wmode');
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $item = $this->model->with('campaign', 'adFormat')->find($id);
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return $this->redirectAfterSave(Input::get('save'));
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list country
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm();
     // get expected close month
     $this->data['listExpectedCloseMonth'] = getMonthRange();
     // get list Currency
     $currencyModel = new CurrencyBaseModel();
     $this->data['listCurrency'] = $currencyModel->getAllForm();
     // get list Sale Status
     $this->data['listSaleStatus'] = Config::get('data.sale_status');
     $this->loadLeftMenu('menu.campaignList');
     // WHEN UPDATE SHOW CURRENT INFORMATION
     if ($id != 0) {
         $item = $this->model->with('agency', 'advertiser', 'sale', 'campaign_manager')->find($id);
         if ($item) {
             $this->data['item'] = $item;
             $this->loadLeftMenu('menu.campaignUpdate', array('item' => $item));
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return Redirect::to($this->moduleURL . 'view/' . $this->data['id']);
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm(0, 0, 'Run of Network');
     // get list Flight Objective
     $this->data['listFlightObjective'] = Config::get('data.flight_objective');
     $this->loadLeftMenu('menu.flightList');
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $this->loadLeftMenu('menu.flightUpdate');
         $item = $this->model->with('category', 'campaign', 'publisher', 'publisherSite', 'publisher_ad_zone')->find($id);
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return $this->redirectAfterSave(Input::get('save'));
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
Esempio n. 7
0
 public static function add($url, $attributes = array())
 {
     if (Str::endsWith($url, '.js')) {
         $url .= '?v=' . rand(0, 999);
         $asset = \HTML::script($url, $attributes);
         $nscript = array('url' => $url, 'html' => $asset);
         $am = Session::get('asset_manager_js', array());
         foreach ($am as $script) {
             if ($url == $script['url']) {
                 return false;
             }
         }
         $am[] = $nscript;
         Session::put('asset_manager_js', $am);
     } elseif (Str::endsWith($url, '.css')) {
         $url .= '?v=' . rand(0, 999);
         $asset = \HTML::style($url, $attributes);
         $nstyle = array('url' => $url, 'html' => $asset);
         $am = Session::get('asset_manager_css', array());
         foreach ($am as $style) {
             if ($url == $style['url']) {
                 return false;
             }
         }
         $am[] = $nstyle;
         Session::put('asset_manager_css', $am);
         return true;
     }
 }
Esempio n. 8
0
 public function action_make()
 {
     echo HTML::script('media/js/qrcode.min.js');
     $text = Arr::get($_GET, 'text', '');
     $width = Arr::get($_GET, 'width', '');
     echo QRJS::makecode($text, $width);
     exit;
 }
Esempio n. 9
0
 /**
  * Gets the default js scripts for the rte
  * 
  * @return string
  */
 public static function get_scripts_html()
 {
     $html = array();
     foreach (self::_get_config('scripts') as $script) {
         $html[] = HTML::script(url::base() . $script);
     }
     return implode("\n", $html);
 }
Esempio n. 10
0
function get_jquery($echo = false)
{
    if ($echo == true) {
        echo HTML::script('/assets/js/jquery.js');
    } else {
        return HTML::script('/assets/js/jquery.js');
    }
}
Esempio n. 11
0
 /**
  * Вывод глобальный переменных в заголовке
  */
 public function hookHead()
 {
     $cogear = new Core_ArrayObject();
     $cogear->settings = new Core_ArrayObject();
     $cogear->settings->site = SITE_URL;
     event('assets.js.global', $cogear);
     echo HTML::script("var cogear = cogear || " . json_encode($cogear) . ";\n\n            window.cogear = cogear;", array(), TRUE);
 }
Esempio n. 12
0
 /**
  * 脚本别名加载(支持批量加载,后期可拓展为自动多文件压缩合并)
  * @return string
  */
 function script()
 {
     $scriptArray = array_map(function ($aliases) {
         $jsUrl = asset_static($aliases);
         return HTML::script($jsUrl);
     }, func_get_args());
     return implode('', array_filter($scriptArray));
 }
Esempio n. 13
0
 /**
  * 
  * get the JS library that we need to generate charts
  * @param  boolean $force forces the inclusion
  * @return string
  */
 public static function include_library($force = FALSE)
 {
     if (self::$included_lib == FALSE or $force == TRUE) {
         self::$included_lib = TRUE;
         return HTML::script((Core::is_HTTPS() ? 'https:' : 'http:') . '//www.google.com/jsapi') . PHP_EOL;
     }
     return FALSE;
 }
Esempio n. 14
0
 public function scripts()
 {
     $this->addCustomScripts();
     $result = '';
     foreach ($this->scripts as $i => $file) {
         $result .= \HTML::script($file);
     }
     return $result;
 }
Esempio n. 15
0
 /**
  * Test generating a link to JavaScript files
  *
  * @group laravel
  */
 public function testGeneratingScript()
 {
     $html1 = HTML::script('foo.js');
     $html2 = HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js');
     $html3 = HTML::script('foo.js', array('type' => 'text/javascript'));
     $this->assertEquals('<script src="http://localhost/foo.js"></script>' . PHP_EOL, $html1);
     $this->assertEquals('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>' . PHP_EOL, $html2);
     $this->assertEquals('<script src="http://localhost/foo.js" type="text/javascript"></script>' . PHP_EOL, $html3);
 }
Esempio n. 16
0
 /**
  * @return	void
  */
 public function action_index()
 {
     $this->template->header->title = $this->river['name'] . ' ~ ' . __('Collaborator Settings');
     $this->template->header->js .= HTML::script("themes/default/media/js/collaborators.js");
     $this->template->content->active = "collaborators";
     $this->template->content->settings_content = View::factory('template/collaborators')->bind('fetch_url', $fetch_url)->bind('collaborator_list', $collaborators);
     $fetch_url = $this->river_base_url . '/collaborators';
     $collaborators = json_encode($this->river_service->get_collaborators($this->river['id']));
 }
/**
 * @param array                    $params
 * @param Smarty_Internal_Template $smarty
 *
 * @throws SmartyException
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_function_html_script($params, Smarty_Internal_Template &$smarty)
{
    if (!isset($params['_url'])) {
        throw new SmartyException('Missing _url attribute for html_script tag');
    }
    $url = $params['_url'];
    unset($params['_url']);
    return HTML::script($url, $params);
}
 /**
  * 脚本别名加载(支持批量加载,后期可拓展为自动多文件压缩合并)
  * @param  dynamic  mixed  配置文件中的别名
  * @return string
  */
 function script()
 {
     $jsAliases = Config::get('extend.jsAliases');
     $scriptArray = array_map(function ($aliases) use($jsAliases) {
         if (isset($jsAliases[$aliases])) {
             return HTML::script($jsAliases[$aliases]);
         }
     }, func_get_args());
     return implode('', array_filter($scriptArray));
 }
Esempio n. 19
0
 /**
  * Вывод скриптов
  */
 public function output()
 {
     if ($this->glue) {
         echo HTML::script(File::pathToUri($this->glue()));
     } else {
         foreach ($this as $script) {
             echo HTML::script(File::pathToUri($script)) . "\n";
         }
     }
 }
Esempio n. 20
0
 function action_index()
 {
     echo '<html>';
     echo '<head>';
     echo $this->ajax->csrf();
     echo '</head><body>';
     echo HTML::script('javascripts/jquery.js');
     echo HTML::script(Route::get('phery.js')->uri());
     echo Phery::link_to('link', 'remote');
     echo '</body></html>';
 }
/**
 * 脚本别名加载(支持批量加载)
 * @param  string|array $aliases    配置文件中的别名
 * @param  array        $attributes 标签中需要加入的其它参数的数组
 * @return string
 */
function script($aliases, $attributes = array(), $interim = '')
{
    if (is_array($aliases)) {
        foreach ($aliases as $k => $v) {
            $interim .= is_int($k) ? script($v, $attributes, $interim) : script($k, $v, $interim);
        }
        return $interim;
    }
    $jsAliases = Config::get('extend.webAssets.jsAliases');
    $url = isset($jsAliases[$aliases]) ? $jsAliases[$aliases] : $aliases;
    return HTML::script($url, $attributes);
}
 public function google_start()
 {
     $this->layout->title = "NOSH ChartingSystem Pre Installation Check";
     $this->layout->style = '';
     $this->layout->script = HTML::script('/js/google_start.js');
     $config_file = __DIR__ . "/../../.google";
     $data['file'] = "<strong>You're' here because you have not installed a Google OAuth2 Client ID file.  You'll need to set this up first before configuring NOSH Charting System.'</strong>";
     if (file_exists($config_file)) {
         $data['file'] = '<strong>A Google OAuth2 Client ID file is already installed.  Uploading a new file will overwrite the existing file!</strong>';
     }
     $this->layout->content = View::make('google_start', $data);
 }
Esempio n. 23
0
 public static function add_js_file($filename, $stack, $name, $after = null)
 {
     //build filename
     if ($filename[0] !== '/') {
         $filename = 'media/js/' . $filename;
     } else {
         $filename = substr($filename, 1);
     }
     $script = htmlspecialchars_decode(HTML::script($filename), ENT_QUOTES);
     //Jx_Debug::dump($script, 'script we are adding');
     self::add_to_stack($script, 'js', $stack, $name, $after);
 }
Esempio n. 24
0
File: helper.php Progetto: ajb/rfpez
 public static function asset($n)
 {
     if (preg_match('/^css/', $n)) {
         $ext = Config::get('assets.use_minified') === false ? ".css" : ".min.css?t=" . Config::get('deploy_timestamp');
         return HTML::style($n . $ext);
     } elseif (preg_match('/^js/', $n)) {
         $ext = Config::get('assets.use_minified') === false ? ".js" : ".min.js?t=" . Config::get('deploy_timestamp');
         return HTML::script($n . $ext);
     } else {
         throw new \Exception("Can't handle that asset type.");
     }
 }
Esempio n. 25
0
 /**
  * Возвращает тег для скрипта
  * @param $file
  * @param null $attributes
  * @return string
  */
 public static function script($file, $attributes = null)
 {
     if (strpos($file, 'http://') !== false) {
         // Set the script link
         $attributes['src'] = $file;
         // Set the script type
         $attributes['type'] = 'text/javascript';
         return '<script' . HTML::attributes($attributes) . '></script>';
     } else {
         return HTML::script('/media/assets/js/' . $file, $attributes);
     }
 }
Esempio n. 26
0
 /**
  * Загружаем Bootstrap с CDN
  */
 public function hookAssets()
 {
     $theme = config('bootstrap.theme', 'default');
     switch ($theme) {
         case 'default':
             echo HTML::style('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css');
             break;
         default:
             echo HTML::style('http://netdna.bootstrapcdn.com/bootswatch/2.3.0/' . $theme . '/bootstrap.min.css');
     }
     echo HTML::style('http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css');
     echo HTML::script('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js');
 }
Esempio n. 27
0
 public function script_files(array $script_files = array())
 {
     if (count($script_files)) {
         $this->_script_files = $script_files;
         return $this;
     } else {
         $html = '';
         foreach ($this->_script_files as $file) {
             $html .= HTML::script($file);
         }
         return $html;
     }
 }
Esempio n. 28
0
 /**
  * @return	void
  */
 public function before()
 {
     // Execute parent::before first
     parent::before();
     // Only owners allowed here
     if (!$this->owner) {
         throw new HTTP_Exception_403();
     }
     $this->template->header->title = $this->bucket['name'] . ' ' . __("Settings");
     $this->template->header->js .= HTML::script('themes/default/media/js/collaborators.js');
     $this->template->content = View::factory('pages/bucket/settings/layout')->bind('active', $this->active)->bind('settings_content', $this->settings_content)->bind('bucket_base_url', $this->bucket_base_url)->bind('bucket', $this->bucket);
     $this->template->content->nav = $this->get_nav();
 }
Esempio n. 29
0
 public static function javascript_include_tag($source, array $attributes = NULL)
 {
     if (strpos('//', $source) === FALSE && isset($source[0]) && $source[0] !== '/') {
         $version = '';
         if (Kohana::$config->load('assets.versionizable') === TRUE) {
             $file_name = Assets::get_file($source, 'js');
             if ($file_name && is_file($file_name)) {
                 $version = '-' . hash_hmac_file('md5', $file_name, Kohana::$config->load('assets.versionizable.hmac_password'));
             }
         }
         $source = '/assets/' . $source . $version . '.js';
     }
     return HTML::script($source, $attributes);
 }
Esempio n. 30
0
 /**
  * Returns a script tag with the compiled file if everything went well,
  * or else it will return script tags with the uncompiled javascript files
  *
  * @param  mixed  $files a string or an array of files
  * @return string Script-tags
  */
 function javascript_compiled($files)
 {
     $gcc = \App::make('gcc');
     $gcc->reset();
     $gcc->setFiles($files);
     if (in_array(\App::environment(), \Config::get('laravel-gcc::env')) && $gcc->compile()) {
         return \HTML::script($gcc->getCompiledJsURL());
     }
     $dir = $gcc->getJsDir();
     $output = "";
     foreach ($gcc->getFiles() as $filename => $path) {
         $output .= \HTML::script($dir . '/' . $filename . '?' . \File::lastModified($path));
     }
     return $output;
 }