Example #1
0
 public function run()
 {
     $config = $this->config();
     if (empty($config['action'])) {
         throw new CException('File Upload: param "action" cannot be empty.');
     }
     unset($config['element']);
     $this->publishAssets();
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $postParams['sizeLimit'] = $this->sizeLimit;
     if (!isset($postParams['cover'])) {
         $postParams['cover'] = true;
     }
     if (!key_exists('file_type', $postParams)) {
         $postParams['file_type'] = 'image';
     }
     $setup = array('element' => 'js:document.getElementById("' . $this->id . '")');
     $setup = array_merge($setup, $config);
     $setup['params'] = $postParams;
     $setup = CJavaScript::encode($setup);
     JS::add('ajaxFileUpload' . $this->id, "var FileUploader_" . $this->id . " = new qq.FileUploader(" . $setup . ");");
     $view = '<div id="' . $this->id . '"><noscript><p>' . Yii::t('admin', 'In order to use the plugin, enable javascript') . '</p></noscript></div>';
     if ($this->multiple == true) {
         $view .= '<p class = "l-hint">' . Yii::t('admin', 'You can upload multiple files simultaneously holding down the shift or ctrl when selecting') . '</p>';
     }
     $view .= '<div id = "j-error_message" class = "l-system_message"></div>';
     echo $view;
 }
Example #2
0
    /**
     * Вывод обложки для file manager
     * @param int $id идентификатор модели
     * @param string $name имя модели
     * @param string $link ссылка, если задана, то выводится ссылка, иначе галерея
     * @param string $noImage если изображение не найдено
     * @param string $type тип изображения, которое хотим получить
     * @return string
     */
    public static function getCover($id, $name, $link = '', $type = 'thumbnail', $noImage = '')
    {
        Yii::import('application.modules.file.models.FileManager');
        $data = FileManager::model()->find('model_name=:model_name AND model_id = :model_id AND cover = 1', array(':model_id' => $id, ':model_name' => $name));
        if ($data === null) {
            $noImage = '<img alt = "" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '"/>';
            if ($link == '') {
                $view = $noImage;
            } else {
                $view = '<a href = "' . $link . '">' . $noImage . '</a>';
            }
        } else {
            $file = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder . DS . $data->folder . DS . $type . DS . $data->file;
            if (Yii::app()->cFile->set($file)->exists) {
                $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/' . $type . '/' . $data->file . '"/>';
            } else {
                $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '/>';
            }
            if ($link == '') {
                $view = '<ul id= "j-photobox_gallery_cover" class = "b-images_view b-image_cover j-photobox_gallery">
						<li class = "l-inline_block">
							<a href = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/original/' . $data->file . '">' . $img . '</a>
						</li>
					</ul>';
                if (!Yii::app()->request->isAjaxRequest) {
                    Yii::app()->clientScript->registerPackage('photobox');
                }
                JS::add('photobox_init', "\$('.j-photobox_gallery').photobox('a',{ 'time':0, 'loop':false, 'afterClose': function(){}});");
            } else {
                $view = '<a href = "' . $link . '">' . $img . '</a>';
            }
        }
        return $view;
    }
Example #3
0
 /**
  * Initialize requires CSS and JS files.
  */
 public static function initDisplay()
 {
     static $inited = false;
     if (!$inited) {
         JS::add('/js/video-js.min.js', false);
         JS::startup('videojs.options.flash.swf = "/swf/video-js.swf"');
         CSS::add('/css/video-js.min.css');
         $inited = true;
     }
 }
Example #4
0
 public function run()
 {
     Yii::app()->getClientScript()->registerCoreScript('jquery.ui');
     JS::add('jquery-ui-sortable', "\$('#d-file_manager_items').sortable({'delay':'300','deactivate':function(event, ui ) { sendImagesPosion();}});");
     Yii::import('application.modules.file.models.FileManager');
     $criteria = FileManager::getSearchCriteria($this->id, $this->modelName);
     $criteria->order = 'position, date DESC';
     if ($this->id < 0) {
         if (Yii::app()->user->hasState('file_manager_folder_' . $this->modelName)) {
             $folderName = Yii::app()->user->getState('file_manager_folder_' . $this->modelName);
         } else {
             $folderName = Yii::app()->getModule('file')->generateName(Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder);
         }
         $criteria->compare('folder', $folderName, true);
     }
     $dataprovider = FileManager::model()->findAll($criteria);
     $this->render('form', array('dataprovider' => $dataprovider));
 }
Example #5
0
    public function seo($title = null, $seoKeywords = null, $seoDescription = null, $name = null)
    {
        if ($title != '') {
            $this->pageTitle = $title;
        } else {
            $this->pageTitle = $name;
        }
        if ($seoKeywords) {
            $this->metaKeywords = $seoKeywords;
        }
        if ($seoDescription) {
            $this->metaDescription = $seoDescription;
        }
        if (Yii::app()->request->isAjaxRequest) {
            JS::add('page_seo', '
			$("title").text("' . addslashes(strip_tags($this->pageTitle)) . '");
			$("meta[name=description]").attr("content", "' . addslashes($this->metaDescription) . '");
			$("meta[name=keywords]").attr("content", "' . addslashes($this->metaKeywords) . '");
		');
        }
    }
 public function buildTheViewScript($viewArray)
 {
     // set the view name
     $viewName = ComponentbuilderHelper::safeString($viewArray['settings']->name_single);
     // add conditions to this view
     if (isset($viewArray['settings']->conditions) && ComponentbuilderHelper::checkArray($viewArray['settings']->conditions)) {
         // reset defaults
         $getValue = array();
         $ifValue = array();
         $targetControls = array();
         $functions = array();
         foreach ($viewArray['settings']->conditions as $condition) {
             if (isset($condition['match_name']) && ComponentbuilderHelper::checkString($condition['match_name'])) {
                 $uniqueVar = $this->uniquekey(7);
                 $matchName = $condition['match_name'] . '_' . $uniqueVar;
                 $targetBehavior = $condition['target_behavior'] == 1 ? 'show' : 'hide';
                 $targetDefault = $condition['target_behavior'] == 1 ? 'hide' : 'show';
                 // make sure only one relation is set
                 $firstTime = true;
                 // set the realtation if any
                 if ($condition['target_relation'] && $firstTime) {
                     // chain to other items of the same target
                     $relations = $this->getTargetRelationScript($viewArray['settings']->conditions, $condition, $viewName);
                     if (ComponentbuilderHelper::checkArray($relations)) {
                         // set behavior and default array
                         $behaviors[$matchName] = $targetBehavior;
                         $defaults[$matchName] = $targetDefault;
                         // set the type buket
                         $typeBuket[$matchName] = $condition['match_type'];
                         // set function array
                         $functions[$uniqueVar][0] = $matchName;
                         $matchNames[$matchName] = $condition['match_name'];
                         // get the select value
                         $getValue[$matchName] = $this->getValueScript($condition['match_type'], $condition['match_name'], $condition['match_extends'], $uniqueVar);
                         // get the options
                         $options = $this->getOptionsScript($condition['match_type'], $condition['match_options']);
                         // set the if values
                         $ifValue[$matchName] = $this->ifValueScript($matchName, $condition['match_behavior'], $condition['match_type'], $options);
                         // set the target controls
                         $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'], $targetBehavior, $targetDefault, $uniqueVar, $viewName);
                         $firstTime = false;
                         foreach ($relations as $relation) {
                             if (ComponentbuilderHelper::checkString($relation['match_name'])) {
                                 $relationName = $relation['match_name'] . '_' . $uniqueVar;
                                 // set the type buket
                                 $typeBuket[$relationName] = $relation['match_type'];
                                 // set function array
                                 $functions[$uniqueVar][] = $relationName;
                                 $matchNames[$relationName] = $relation['match_name'];
                                 // get the relation option
                                 $relationOptions = $this->getOptionsScript($relation['match_type'], $relation['match_options']);
                                 $getValue[$relationName] = $this->getValueScript($relation['match_type'], $relation['match_name'], $condition['match_extends'], $uniqueVar);
                                 $ifValue[$relationName] = $this->ifValueScript($relationName, $relation['match_behavior'], $relation['match_type'], $relationOptions);
                             }
                         }
                     }
                 } else {
                     // set behavior and default array
                     $behaviors[$matchName] = $targetBehavior;
                     $defaults[$matchName] = $targetDefault;
                     // set the type buket
                     $typeBuket[$matchName] = $condition['match_type'];
                     // set function array
                     $functions[$uniqueVar][0] = $matchName;
                     $matchNames[$matchName] = $condition['match_name'];
                     // get the select value
                     $getValue[$matchName] = $this->getValueScript($condition['match_type'], $condition['match_name'], $condition['match_extends'], $uniqueVar);
                     // get the options
                     $options = $this->getOptionsScript($condition['match_type'], $condition['match_options']);
                     // set the if values
                     $ifValue[$matchName] = $this->ifValueScript($matchName, $condition['match_behavior'], $condition['match_type'], $options);
                     // set the target controls
                     $targetControls[$matchName] = $this->setTargetControlsScript($condition['target_field'], $targetBehavior, $targetDefault, $uniqueVar, $viewName);
                 }
             }
         }
         // reset buckets
         $initial = '';
         $func = '';
         $validation = '';
         $isSet = '';
         $listener = '';
         if (ComponentbuilderHelper::checkArray($functions)) {
             // now build the initial script
             $initial .= "// Initial Script\njQuery(document).ready(function()";
             $initial .= "\n{";
             foreach ($functions as $function => $matchKeys) {
                 $func_call = $this->buildFunctionCall($function, $matchKeys, $getValue);
                 $initial .= $func_call['code'];
             }
             $initial .= "});\n";
             // for modal fields
             $modal = '';
             // now build the listener scripts
             foreach ($functions as $l_function => $l_matchKeys) {
                 $funcCall = '';
                 foreach ($l_matchKeys as $l_matchKey) {
                     $name = $matchNames[$l_matchKey];
                     $matchTypeKey = $typeBuket[$l_matchKey];
                     $funcCall = $this->buildFunctionCall($l_function, $l_matchKeys, $getValue);
                     if (isset($this->setScriptMediaSwitch) && ComponentbuilderHelper::checkArray($this->setScriptMediaSwitch) && in_array($matchTypeKey, $this->setScriptMediaSwitch)) {
                         $modal .= $funcCall['code'];
                     } else {
                         if (isset($this->setScriptUserSwitch) && ComponentbuilderHelper::checkArray($this->setScriptUserSwitch) && in_array($matchTypeKey, $this->setScriptUserSwitch)) {
                             $name = $name . '_id';
                         }
                         $listener .= "\n// #jform_" . $name . " listeners for " . $l_matchKey . " function";
                         $listener .= "\njQuery('#jform_" . $name . "').on('keyup',function()";
                         $listener .= "\n{";
                         $listener .= $funcCall['code'];
                         $listener .= "\n});";
                         $listener .= "\njQuery('#adminForm').on('change', '#jform_" . $name . "',function (e)";
                         $listener .= "\n{";
                         $listener .= "\n\te.preventDefault();";
                         $listener .= $funcCall['code'];
                         $listener .= "\n});\n";
                     }
                 }
             }
             if (ComponentbuilderHelper::checkString($modal)) {
                 $listener .= "\nwindow.SqueezeBox.initialize({";
                 $listener .= "\n\tonClose:function(){";
                 $listener .= $modal;
                 $listener .= "\n\t}";
                 $listener .= "\n});\n";
             }
             // now build the function
             $func = '';
             $head = '';
             foreach ($functions as $f_function => $f_matchKeys) {
                 $map = '';
                 // does this function require an array
                 $addArray = false;
                 $func_ = $this->buildFunctionCall($f_function, $f_matchKeys, $getValue);
                 // set array switch
                 if ($func_['array']) {
                     $addArray = true;
                 }
                 $func .= "\n// the " . $f_function . " function";
                 $func .= "\nfunction " . $f_function . "(";
                 $fucounter = 0;
                 foreach ($f_matchKeys as $fu_matchKey) {
                     if (ComponentbuilderHelper::checkString($fu_matchKey)) {
                         if ($fucounter == 0) {
                             $func .= $fu_matchKey;
                         } else {
                             $func .= ',' . $fu_matchKey;
                         }
                         $fucounter++;
                     }
                 }
                 $func .= ")";
                 $func .= "\n{";
                 if ($addArray) {
                     foreach ($f_matchKeys as $a_matchKey) {
                         $name = $matchNames[$a_matchKey];
                         $func .= "\n\tif (isSet(" . $a_matchKey . ") && " . $a_matchKey . ".constructor !== Array)\n\t{\n\t\tvar temp_" . $f_function . " = " . $a_matchKey . ";\n\t\tvar " . $a_matchKey . " = [];\n\t\t" . $a_matchKey . ".push(temp_" . $f_function . ");\n\t}";
                         $func .= "\n\telse if (!isSet(" . $a_matchKey . "))\n\t{";
                         $func .= "\n\t\tvar " . $a_matchKey . " = [];";
                         $func .= "\n\t}";
                         $func .= "\n\tvar " . $name . " = " . $a_matchKey . ".some(" . $a_matchKey . "_SomeFunc);\n";
                         // setup the map function
                         $map .= "\n// the " . $f_function . " Some function";
                         $map .= "\nfunction " . $a_matchKey . "_SomeFunc(" . $a_matchKey . ")";
                         $map .= "\n{";
                         $map .= "\n\t//" . $this->setLine(__LINE__) . " set the function logic";
                         $map .= "\n\tif (";
                         $if = $ifValue[$a_matchKey];
                         if (ComponentbuilderHelper::checkString($if)) {
                             $map .= $if;
                         }
                         $map .= ")";
                         $map .= "\n\t{";
                         $map .= "\n\t\treturn true;";
                         $map .= "\n\t}\n\treturn false;";
                         $map .= "\n}\n";
                     }
                     $func .= "\n\n\t//" . $this->setLine(__LINE__) . " set this function logic";
                     $func .= "\n\tif (";
                     // set if counter
                     $aifcounter = 0;
                     foreach ($f_matchKeys as $af_matchKey) {
                         $name = $matchNames[$af_matchKey];
                         if ($aifcounter == 0) {
                             $func .= $name;
                         } else {
                             $func .= ' && ' . $name;
                         }
                         $aifcounter++;
                     }
                     $func .= ")\n\t{";
                 } else {
                     $func .= "\n\t//" . $this->setLine(__LINE__) . " set the function logic";
                     $func .= "\n\tif (";
                     // set if counter
                     $ifcounter = 0;
                     foreach ($f_matchKeys as $f_matchKey) {
                         $if = $ifValue[$f_matchKey];
                         if (ComponentbuilderHelper::checkString($if)) {
                             if ($ifcounter == 0) {
                                 $func .= $if;
                             } else {
                                 $func .= ' && ' . $if;
                             }
                             $ifcounter++;
                         }
                     }
                     $func .= ")\n\t{";
                 }
                 // get the controles
                 $controls = $targetControls[$f_matchKeys[0]];
                 // get target behavior and default
                 $targetBehavior = $behaviors[$f_matchKeys[0]];
                 $targetDefault = $defaults[$f_matchKeys[0]];
                 // load the target behavior
                 foreach ($controls as $target => $action) {
                     $func .= $action['behavior'];
                     if (ComponentbuilderHelper::checkString($action['hide'])) {
                         $func .= $action[$targetBehavior];
                         $head .= $action['requiredVar'];
                     }
                 }
                 $func .= "\n\t}\n\telse\n\t{";
                 foreach ($controls as $target => $action) {
                     $func .= $action['default'];
                     if (ComponentbuilderHelper::checkString($action['hide'])) {
                         $func .= $action[$targetDefault];
                     }
                 }
                 $func .= "\n\t}\n}\n" . $map;
             }
             // add the needed validation to file
             if (isset($this->validationFixBuilder[$viewName]) && ComponentbuilderHelper::checkArray($this->validationFixBuilder[$viewName])) {
                 $validation .= "\n// update required fields";
                 $validation .= "\nfunction updateFieldRequired(name,status)";
                 $validation .= "\n{";
                 $validation .= "\n\tvar not_required = jQuery('#jform_not_required').val();";
                 $validation .= "\n\n\tif(status == 1)";
                 $validation .= "\n\t{";
                 $validation .= "\n\t\tif (isSet(not_required) && not_required != 0)";
                 $validation .= "\n\t\t{";
                 $validation .= "\n\t\t\tnot_required = not_required+','+name;";
                 $validation .= "\n\t\t}";
                 $validation .= "\n\t\telse";
                 $validation .= "\n\t\t{";
                 $validation .= "\n\t\t\tnot_required = ','+name;";
                 $validation .= "\n\t\t}";
                 $validation .= "\n\t}";
                 $validation .= "\n\telse";
                 $validation .= "\n\t{";
                 $validation .= "\n\t\tif (isSet(not_required) && not_required != 0)";
                 $validation .= "\n\t\t{";
                 $validation .= "\n\t\t\tnot_required = not_required.replace(','+name,'');";
                 $validation .= "\n\t\t}";
                 $validation .= "\n\t}";
                 $validation .= "\n\n\tjQuery('#jform_not_required').val(not_required);";
                 $validation .= "\n}\n";
             }
             // set the isSet function
             $isSet = "\n// the isSet function";
             $isSet .= "\nfunction isSet(val)";
             $isSet .= "\n{";
             $isSet .= "\n\tif ((val != undefined) && (val != null) && 0 !== val.length){";
             $isSet .= "\n\t\treturn true;";
             $isSet .= "\n\t}";
             $isSet .= "\n\treturn false;";
             $isSet .= "\n}";
         }
         // load to this buket
         $fileScript = $initial . $func . $validation . $isSet;
         $footerScript = $listener;
     }
     // add custom script to file
     if (isset($this->customScriptBuilder['view_file'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_file'][$viewName])) {
         if (!isset($fileScript)) {
             $fileScript = '';
         }
         $fileScript .= "\n\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['view_file'][$viewName]);
     }
     // add custom script to footer
     if (isset($this->customScriptBuilder['view_footer'][$viewName]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['view_footer'][$viewName])) {
         $customFooterScript = "\n\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['view_footer'][$viewName]);
         if (strpos($customFooterScript, '<?php') === false) {
             // only add now if no php is added to the footer script
             if (!isset($footerScript)) {
                 $footerScript = '';
             }
             $footerScript .= $customFooterScript;
             unset($customFooterScript);
         }
     }
     // minfy the script
     if ($this->params->get('minify') && isset($fileScript) && ComponentbuilderHelper::checkString($fileScript)) {
         // minify the fielScript javscript
         $minifier = new JS();
         $minifier->add($fileScript);
         $fileScript = $minifier->minify();
     }
     // minfy the script
     if ($this->params->get('minify') && isset($footerScript) && ComponentbuilderHelper::checkString($footerScript)) {
         // minify the footerScript javscript
         $minifier = new JS();
         $minifier->add($footerScript);
         $footerScript = $minifier->minify();
     }
     // make sure there is script to add
     if (isset($fileScript) && ComponentbuilderHelper::checkString($fileScript)) {
         // add the head script if set
         if (isset($head) && ComponentbuilderHelper::checkString($head)) {
             $fileScript = "// Some Global Values\n" . $head . "\n" . $fileScript;
         }
         // load the script
         $this->editBodyViewScriptBuilder[$viewName]['fileScript'] = $fileScript;
     }
     // make sure to add custom footer script if php was found in it, since we canot minfy it with php
     if (isset($customFooterScript) && ComponentbuilderHelper::checkString($customFooterScript)) {
         if (!isset($footerScript)) {
             $footerScript = '';
         }
         $footerScript .= $customFooterScript;
     }
     // make sure there is script to add
     if (isset($footerScript) && ComponentbuilderHelper::checkString($footerScript)) {
         // add the needed script tags
         $footerScript = "\n\n" . '<script type="text/javascript">' . "\n" . $footerScript . "\n</script>";
         $this->editBodyViewScriptBuilder[$viewName]['footerScript'] = $footerScript;
     }
 }
Example #7
0
				return true;
			}
		</script>
		<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<?
	CSS::add("/styles/jquery-ui-1.8.17.custom.css");
	CSS::add("/styles/pic.css");
	CSS::emit();
	JS::add("/offensive/js/jquery-1.7.1.min.js");
	JS::add("/offensive/js/tmbolib.js");
	JS::add("/offensive/js/jquery-ui-1.8.17.custom.min.js");
	JS::add("/offensive/js/jquery.ba-outside-events.min.js");
	JS::add("/offensive/js/subscriptions.js");
	JS::add("/offensive/js/irsz.js");
	JS::add("/offensive/js/picui.js");
	JS::add("/offensive/js/analytics.js");
	JS::emit();
?>
		<script type="text/javascript">
			var me = {
				hide_nsfw: <?= me()->getPref("hide_nsfw") == 1 ? 'true' : 'false' ?>,
				hide_tmbo: <?= me()->getPref("hide_tmbo") == 1 ? 'true' : 'false' ?>,
				hide_bad: <?= me()->getPref("hide_bad") == 1 ? 'true' : 'false' ?>,
				squelched: <?= json_encode(me()->squelched_list()) ?>
			}
			getSocket("<?php $t = new Token("realtime"); echo $t->tokenid(); ?>", function(socket) {
				socket.on('comment', function(comment) {
					var stats_row = $("#voting_stats");
					if (comment.comment) {
						var comments_count = parseInt(stats_row.find('#count_comment').text()) + 1;
						stats_row.find('#count_comment').text(comments_count);
Example #8
0
 Echo the big graphical menu, function called by the admin modules
	$cat: Which menucategory to show, default = all
************************************************************************************/
function GraphicAdmin($cat = 'all')
{
    global $CLASS, $cpgtpl;
    require_once CORE_PATH . 'classes/cpg_adminmenu.php';
    if ($CLASS['adminmenu']->display($cat, 'graph')) {
        $cpgtpl->set_filenames(array('body' => 'admin/index_body.html'));
        $cpgtpl->display('body');
    }
}
$op = !empty($_GET['op']) ? $_GET['op'] : (isset($_POST['op']) ? $_POST['op'] : 'index');
if ($MAIN_CFG['global']['admingraphic'] >= '4' || strtolower($op) == 'forums') {
    JS::add('includes/javascript/JSCookMenu.js');
    JS::add('themes/default/javascript/cookmenu.js');
    CSS::add('themes/default/style/cookmenu.css');
}
global $CPG_SESS;
if ($op == 'logout') {
    unset($CPG_SESS['admin']);
    $redir = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $mainindex;
    cpg_error(_YOUARELOGGEDOUT, _ADMINMENU_LOGOUT, $redir);
} else {
    if ($CLASS['member']->admin_id) {
        if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $op)) {
            cpg_error(sprintf(_ERROR_BAD_CHAR, strtolower(_ADMIN)), _SEC_ERROR);
        }
        $Module = new Module('Admin');
        Blocks::$showblocks = $Module->sides;
        $Blocks = new Blocks(-1);
Example #9
0
?>
</h2>
		<div class = "b-admin_post_seo j-admin_post_seo">
			<div class="l-row">
				<?php 
echo $form->textFieldControlGroup($model, 'seo_title');
?>
			</div>
			
			<div class="l-row">
				<?php 
echo $form->textAreaControlGroup($model, 'seo_description');
?>
			</div>
			
			<div class="l-row">
				<?php 
echo $form->textAreaControlGroup($model, 'seo_keywords');
?>
			</div>
	
			<div class="l-row">
				<?php 
echo $form->textFieldControlGroup($model, 'url');
?>
			</div>
		</div>
	</div>
<?php 
JS::add('seoInit', 'seoInit("' . Yii::t('admin', 'Show') . '", "' . Yii::t('admin', 'Hide') . '", "btn btn-default btn-sm");', 0);
Example #10
0
 public static function listBox($model, $form, $data, $attribute = '')
 {
     $options = array();
     if (isset($model->{$attribute})) {
         $m = explode(",", $model->{$attribute});
         foreach ($m as $v) {
             $options[$v] = array('selected' => 'selected');
         }
     }
     Yii::app()->clientScript->registerPackage('choosen');
     $view = $form->listBoxControlGroup($model, $attribute, $data, array('multiple' => 'multiple', 'size' => count($data), 'options' => $options, 'class' => 'j-choosen'));
     JS::add('choosen', "\$('.j-choosen').chosen({\n\t\t\t\t'search_contains':true,\n\t\t\t\t'width': '100%'\n\t\t\t});");
     return $view;
 }
Example #11
0
// optional
Module::$path = BASEDIR . "modules/{$Module->path_name}/";
// optional
Module::$is_home = $Module->name === $MAIN_CFG['global']['main_module'];
/* finished instructing class */
# check for permissions
$Module->allow();
# get module custom language
get_lang($Module->name, -1);
# setup blocks, showblocks may be depreciated in the near future
Blocks::$showblocks = $Module->sides;
/* compatibility */
$home = Module::$is_home;
$module_name = $Module->name;
$showblocks = $Module->sides;
$module_title = $Module->title;
/* end compatibility */
JS::add('includes/javascript/poodle.js');
if ($MAIN_CFG['global']['admin_help']) {
    JS::add('includes/javascript/infobox.js');
}
//MetaTag::add(Module::$metatag); // must include Page data already
require 'includes/meta.php';
require Module::$path . Module::$file . '.php';
if ($Module->name === 'smilies') {
    echo smilies_table('window', $_GET['field'], $_GET['form']);
    exit;
}
if (defined('HEADER_OPEN')) {
    require_once 'footer.php';
}
Example #12
0
    echo '<ul id= "j-photobox_gallery_' . $this->modelName . '" class = "b-images_view j-photobox_gallery">';
    foreach ($dataprovider as $data) {
        $file = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder . DS . $data->folder . DS . $this->type . DS;
        if (Yii::app()->cFile->set($file . $data->file)->exists) {
            $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/' . $this->type . '/' . $data->file . '"/>';
        } else {
            $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '/>';
        }
        ?>
	<li class = "l-inline_block">
		<a href = "/upload/<?php 
        echo Yii::app()->getModule('file')->uploadFolder;
        ?>
/<?php 
        echo $data->folder;
        ?>
/original/<?php 
        echo $data->file;
        ?>
">
			<?php 
        echo $img;
        ?>
		</a>
	</li>
	<?php 
    }
    echo '</ul>';
    JS::add('photobox_init', "\$('.j-photobox_gallery').photobox('a',{ 'time':0, 'loop':false, 'afterClose': function(){}});");
    //JS::add('lazy_init', '$(".j-lazy").lazy({effect: "fadeIn", effectTime: 1000});');
}