当前位置: 首页>>代码示例>>PHP>>正文


PHP JS::lib方法代码示例

本文整理汇总了PHP中JS::lib方法的典型用法代码示例。如果您正苦于以下问题:PHP JS::lib方法的具体用法?PHP JS::lib怎么用?PHP JS::lib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JS的用法示例。


在下文中一共展示了JS::lib方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: imageEditor

 function imageEditor()
 {
     JS::loadjQuery();
     JS::lib('jquery/jquery.imgareaselect-*');
     JS::lib('imgTools');
     $size = getimagesize($this->that->path);
     return Form::quick(false, __('Save'), new Input(__('Filename'), 'filename', $_POST['filename'] ? $_POST['filename'] : $this->that->basename), new Hidden('cropimgx', $_POST['cropimgx']), new Hidden('cropimgy', $_POST['cropimgy']), new Hidden('cropimgw', $_POST['cropimgw']), new Hidden('cropimgh', $_POST['cropimgh']), new Tabber('img', new Tab(__('Cropping'), '<div id="imgcropper"><img style="float: left" id="originalImage" src="?id=' . $this->that->ID . '&amp;w=400" /><div style="clear: both;"></div></div>'), new Tab(__('Resize'), '<div id="imgresize"><div id="resval" style="clear: right;"><input name="resimgx" id="resimgx" size="4" value="' . $size[0] . '" />x<input name="resimgy" id="resimgy" size="4" value="' . $size[1] . '" /></div></div>'), new Tab(__('Rotate'), new Select(__('Specify rotation (CCW)'), 'imgrot', array('0' => __('None'), '90' => '90 &deg;', '180' => '180 &deg;', '270' => '270 &deg;'), $_REQUEST['imgrot']))));
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:8,代码来源:ImageEditor.php

示例2: render

 function render()
 {
     JS::loadjQuery();
     JS::lib('viewslider');
     JS::raw('$(function(){$("div.viewslider-view").closest(".formdiv").viewslider();});');
     Head::add('viewslider/viewslider', 'css-lib');
     return '<div class="formsection viewslider-view"><h3>' . $this->header . '</h3>' . implode('', flatten($this->elements)) . '</div>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:8,代码来源:Formsection.php

示例3: render

 function render()
 {
     $id = idfy($this->name);
     JS::loadjQuery(false);
     JS::lib('imgPicker');
     JS::raw('setupPreview("' . $id . '");');
     //FIXME: Flytta styling till stylesheet!
     return '<span class="formelem">' . ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '" class="text' . ($this->validate ? ' ' . $this->validate : '') . '" value="' . $this->value . '" type="hidden" />' . '<div class="tools">' . icon('small/cross', __('Remove'), "javascript:removePreview('{$id}');", $id . "remicon") . icon('small/folder_picture', __('Browse picture'), "javascript:explore('{$id}', " . ($this->dir ? $this->dir : 'false') . ");") . '</div>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : '') . ($this->preview ? '<div id="' . $id . 'prev" style="margin:10px 0 5px 150px;"><img id="' . $id . 'img" src="index.php?id=' . $this->value . '&mw=300" /></div>' : '') . '</span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:9,代码来源:ImagePicker.php

示例4: render

 function render()
 {
     $id = idfy($this->name);
     if (is_array($this->value)) {
         $value = Short::parseDateAndTime($this->value);
     }
     global $CONFIG;
     JS::loadjQuery(true);
     JS::lib('jquery/jquery.timePicker');
     Head::add('timePicker', 'css-lib');
     Head::add('$(function(){$("input.time").timePicker();});', 'js-raw');
     return '<span class="formelem">' . ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '" class="time' . ($this->validate ? ' ' . $this->validate : '') . ($this->class ? ' ' . $this->class : '') . '" value="' . (is_numeric($this->value) ? date('H:i', $this->value) : $this->value) . '" />' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : '') . '</span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:13,代码来源:Timepickr.php

示例5: render

 function render()
 {
     $id = idfy($this->name);
     if ($this->multiple) {
         JS::loadJQuery(true);
         JS::lib('jquery/plugins/localisation/jquery.localisation-min');
         JS::lib('jquery/plugins/scrollTo/jquery.scrollTo-min');
         JS::lib('jquery/ui.multiselect');
         if (!$this->nojs) {
             /*FIXME: Translation
                             JS::raw('$(function(){$.localise("ui-multiselect", {language: "en", path: "lib/js/locale/"});});');
             */
             JS::raw('$(function(){$("#' . $id . '").multiselect({' . $this->jsparams . '});});');
         }
         Head::add('ui.multiselect', 'css-lib');
         if ($this->class) {
             $this->class .= ' ';
         }
         $this->class .= 'multiselect';
     }
     $r = ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<select id="' . $id . '" name="' . $this->name . ($this->multiple ? '[]" multiple="multiple"' : '"') . ' class="' . $this->validate . ($this->validate ? ' ' : '') . $this->class . '">';
     if ($this->startEmpty) {
         $r .= '<option value="">' . ($this->startEmpty !== true ? $this->startEmpty : '') . '</option>';
     }
     if (is_array($this->data)) {
         foreach ($this->data as $value => $text) {
             if (is_array($text)) {
                 if (isset($text['id'])) {
                     $r .= $this->inflatedGroup($text);
                 } else {
                     $r .= $this->optgroup($value, $text);
                 }
             } else {
                 if (is_bool($this->selected)) {
                     $s = $this->selected;
                 } else {
                     $match_pos = array_search($value, $this->selected, true);
                     if (!$match_pos) {
                         $match_pos = array_search($value, $this->selected);
                     }
                     $match = $match_pos === false ? false : $this->selected[$match_pos];
                     $s = strcmp($match, $value) === 0;
                 }
                 $r .= '<option value="' . $value . '"' . ($s ? ' selected="selected"' : '') . '>' . $text . '</option>';
             }
         }
     }
     $r .= '</select>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : ($this->multiple ? '&nbsp;' : ''));
     return '<span class="formelem">' . $r . '</span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:50,代码来源:Select.php

示例6: render

 function render()
 {
     $id = idfy($this->name);
     JS::loadjQuery(false);
     if ($this->available_values) {
         JS::lib('jquery/jquery.bgiframe.min');
         JS::lib('jquery/jquery-plugin-ajaxqueue');
         JS::lib('jquery/jquery.autocomplete.min');
         Head::add('jquery.autocomplete', 'css-lib');
         JS::raw('$(function(){$("#' . $id . '").autocomplete(["' . join('","', $this->available_values) . '"], {width: 320,max: 4,highlight: false,multiple: true,multipleSeparator: " ",scroll: true,scrollHeight: 300})});');
     }
     $r = ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '" class="text tags' . ($this->validate ? ' ' . $this->validate : '') . '" value="' . $this->value . '" />' . ($this->description ? '<span class="description">' . $this->description . '</span>' : '');
     return '<span class="formelem">' . $r . '</span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:14,代码来源:TagInput.php

示例7: safeEmailsHelper

 /**
  * Replaces the emails with a flash text with the email
  * @param $match preg_replace match
  * @return string Flash html-code
  */
 function safeEmailsHelper($match)
 {
     JS::lib('flashurl', false, false);
     JS::loadjQuery(false, false);
     static $i = 0;
     $i++;
     if (count($match) == 2) {
         $url = $match[0];
         $label = false;
     } else {
         $url = $match[1];
         $label = $match[2];
         if (isEmail($label)) {
             $label = false;
         }
     }
     $url = base64_encode($url);
     return '<span class="flashurl"><object id="flashurl' . $i . '" type="application/x-shockwave-flash" data="lib/swf/flashurl.swf"><param name="FlashVars" value="divID=flashurl' . $i . '&amp;encURL=' . urlencode($url) . ($label ? '&amp;urlLabel=' . $label : '') . '" /><param name="movie" value="/lib/swf/flashurl.swf" /><param name="wmode" value="transparent" /></object></span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:24,代码来源:SafeEmails.php

示例8: lib

 function lib($what, $IE = false, $defer = true)
 {
     if (!is_array($what)) {
         $what = array($what);
     }
     global $SITE;
     foreach ($what as $inc) {
         $cdir = getcwd();
         chdir($SITE->base_dir . '/lib/js');
         $files = glob($inc . '.js');
         if (empty($files)) {
             chdir($cdir);
             return;
         }
         sort($files);
         $file = array_pop($files);
         if (!($dep = file($file))) {
             chdir($cdir);
             return;
         }
         chdir($cdir);
         $dep = $dep[0];
         if (preg_match('#^//Deps:#', $dep)) {
             $deps = explode(',', substr($dep, 7));
             foreach ($deps as $d) {
                 $d = trim($d);
                 if ($d == 'jquery') {
                     self::loadjQuery(false, $defer);
                 } elseif ($d == 'jquery-ui') {
                     self::loadjQuery(true, $defer);
                 } else {
                     JS::lib($d, $IE, $defer);
                 }
             }
         }
         Head::add($inc, 'js-lib', $defer, true, $IE);
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:38,代码来源:JS.php

示例9: viewAds

 function viewAds()
 {
     //FIXME:Move setting to CompanyEditor
     $slider = true;
     $cycletime = 5000;
     $r = '';
     $ms = self::sortedList('main');
     $s = self::sortedList('sub');
     if ($ms) {
         $r .= '<div class="col first four company"><h2>' . __('Main sponsors') . '</h2>' . $ms . '</div>';
     }
     if ($s) {
         $r .= '<div class="col first four company"><h2>' . __('Sponsors') . '</h2>' . $s . '</div>';
     }
     if ($slider) {
         JS::lib('jquery/jquery.cycle.all.min');
         JS::raw('$(function(){
                     $(".companies_sub").css({height:"230px"}).children("li").css({top:0,left:0,position:"fixed"});
                     $(".companies_sub").cycle({fx:"scrollHorz",timeout:' . $cycletime . '});
                 });');
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:23,代码来源:Companies.php

示例10: internal

 function internal($title, $image, $alt = '', $youtube = false, $youtubetext = false, $comment = false)
 {
     if (!$youtubetext) {
         $youtubetext = 'Dagens videolänk';
     }
     if (is_array($image)) {
         JS::loadjQuery();
         JS::lib('jquery/jquery.cycle.all.2.72');
         JS::raw("\$('.images').cycle({fx:'fade'});");
     } else {
         $image = array($image);
     }
     Head::add('h1 {font-size: 3em; color: #000;} div {text-align: center;} .images {position: relative; left: 600px; margin: 0 0 0 -525px; width: 600px;} .youtube {font-size: 2em;} .wrapper {border: 10px solid red;}', 'css-raw');
     $r = '';
     if ($title) {
         $r .= '<h1>' . $title . '</h1>';
     }
     $r .= '<div class="images">';
     foreach ($image as $img) {
         if ($img[0] == '<') {
             $r .= $img;
         } else {
             $r .= '<img src="' . $img . '" alt="' . $alt . '" title="' . $alt . '" />';
         }
     }
     $r .= '</div>';
     if ($comment) {
         $r .= '<div class="comment">' . nl2br($comment) . '</div>';
     }
     if ($youtube) {
         $youtube = (array) $youtube;
         $youtubetext = (array) $youtubetext;
         foreach ($youtube as $i => $yt) {
             if (isset($youtubetext[$i])) {
                 $r .= '<div class="youtube"><a href="' . $yt . '" target="_blank">' . $youtubetext[$i] . '</a></div>';
             }
         }
     }
     $this->setContent('main', $r);
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:40,代码来源:YAdvCal.php

示例11: dropdown

 function dropdown($icon, $text, $rows, $class = "")
 {
     JS::loadjQuery(false);
     JS::lib('dropdowns');
     return '<span class="dropdown' . ($class ? " " . $class : '') . '">' . '<span class="dropdown-icon">' . icon($icon, $text, false, true) . '</span>' . '<ul><li>' . (is_array($rows) ? implode('</li><li>', $rows) : $rows) . '</li></ul></span>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:6,代码来源:Box.php

示例12: genHTML

 /**
  * Generate the XHTML/CSS to administrate the folder
  * @return void
  */
 function genHTML()
 {
     $this->loadStructure();
     $this->fileExtCSS();
     global $CONFIG, $Controller;
     Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
     $r = '<div class="ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">' . '<span class="fixed-width">' . $this->pcrumbs() . '</span>' . Box::tools($this) . '</div>';
     $r .= '<ul class="filetree">';
     $i = 0;
     foreach ($this->folders as $cur) {
         if (!$cur->mayI(READ)) {
             continue;
         }
         $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . ' directory">' . '<span class="fixed-width"><a href="' . url(array('id' => $cur->ID), array('popup', 'filter')) . '" title="' . __('Open folder') . '">' . $cur . '</a></span>' . Box::tools($cur) . icon('large/down-16', __('Download'), url(array('id' => $cur->ID, 'action' => 'download'))) . '</li>';
         $i++;
     }
     $r .= '</ul>';
     global $SITE;
     if ($_REQUEST['popup'] == "ckeditor") {
         //http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_(Uploader)/Custom_File_Browser
         Head::add("function getUrlParam(paramName)\n\t\t{\n\t\t  var reParam = new RegExp('(?:[\\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;\n\t\t  var match = window.location.search.match(reParam) ;\n\n\t\t  return (match && match.length > 1) ? match[1] : '' ;\n\t\t}\n\t\tvar funcNum = getUrlParam('CKEditorFuncNum');\n\t\tvar fileUrl = 'https://www.ysektionen.se/';\n\t\t", 'js-raw');
         Head::add("function select(id) {try{window.opener.CKEDITOR.tools.callFunction(funcNum, 'https://www.ysektionen.se/'+id);} catch(err) {}window.close();}", 'js-raw');
     } else {
         if ($_REQUEST['popup']) {
             Head::add("function select(id) {try{window.opener.fileCallback(id,'{$_REQUEST['popup']}');} catch(err) {}window.close();}", 'js-raw');
         }
     }
     foreach ($this->files as $cur) {
         if (!$cur->mayI(READ)) {
             continue;
         }
         if ($_REQUEST['filter']) {
             switch ($_REQUEST['filter']) {
                 case 'images':
                 case 'documents':
                     if (!in_array(strtolower($cur->extension), $CONFIG->extensions->{$_REQUEST['filter']})) {
                         continue 2;
                     }
                     break;
                 default:
                     if (!stristr($cur->basename, $_REQUEST['filter'])) {
                         continue 2;
                     }
             }
         }
         $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . ' file ext_' . $cur->extension . '"><span class="fixed-width"';
         if ($_REQUEST['popup']) {
             $r .= '></span><a href="javascript: select(' . $cur->ID . ');"';
         }
         if ($cur->isImage()) {
             if (!$_REQUEST['popup']) {
                 $r .= '><span';
             }
             JS::lib('jquery/imgPreview');
             Head::add('#imgpreview{' . 'position:absolute;' . 'border:1px solid #ccc;' . 'background:#333;' . 'padding:5px;' . 'display:none;' . 'color:#fff;}', 'css-raw');
             $r .= ' class="imagepreview" rel="/' . $cur->ID . '?mw=100">' . $cur->basename;
             if (!$_REQUEST['popup']) {
                 $r .= '</span>';
             }
         } else {
             $r .= '>' . $cur->basename;
         }
         if ($_REQUEST['popup']) {
             $r .= '</a>';
         }
         $r .= '</span><div class="tools">' . Box::tools($cur) . '</div></li>';
         $i++;
     }
     return $r . '</ul>';
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:74,代码来源:Folder.php

示例13: makeMenu

 /**
  * Render the menu for editing
  * @param array $array
  * @return string
  */
 private function makeMenu($array)
 {
     static $i = 0;
     static $recursion = 0;
     if (count($array) == 0) {
         return;
     }
     ++$recursion;
     global $CONFIG, $USER;
     if ($this->mayI(EDIT)) {
         JS::loadjQuery(false);
         JS::lib('menusort');
     }
     /* $r=''; */
     $r = '<ul class="menulist">';
     $save = array('edit', 'with', 'id');
     while (list(, $obj) = each($array)) {
         $r .= '<li id="m' . $obj['id'] . '" class="' . (++$i % 2 ? 'odd' : 'even') . (is_a($obj['object'], 'MenuSection') ? ' menusection' : '') . '"><span class="fixed-width">' . $obj['object'] . '</span>' . Box::tools($obj['object']) . Box::dropdown('small/add', false, array(icon('small/arrow_right', __('New child page'), url(array('action' => 'newpage', 'where' => 'child', 'to' => $obj['id']), $save), true), icon('small/arrow_down', __('New page below'), url(array('action' => 'newpage', 'where' => 'below', 'to' => $obj['id']), $save), true))) . Box::dropdown('small/arrow_out', false, false, 'pagemove') . (isset($obj['children']) ? $this->makeMenu($obj['children']) : '') . '</li>';
     }
     $r .= '</ul>';
     --$recursion;
     if ($recursion == 0) {
         $i = 0;
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:31,代码来源:MenuEditor.php

示例14: collection

 /**
  * Creates the form for outputting
  * Usage example
  * <code>
  *	$form = new Form('uploadToFolder', url(null, 'id'));
  *	return $form->collection(
  *		new Fieldset(__('Select files'),
  *			new FileUpload(__('File to upload'), 'uFiles[]'),
  *			new CheckBox(__('Uncompress compressed files'), 'uncompress', false)
  *		),
  *		new Fieldset(__('Select another file'),
  *			new FileUpload(__('File to upload'), 'uFiles[]'),
  *			new CheckBox(__('Uncompress compressed files'), 'uncompress', false)
  *		)
  *	);
  * </code>
  * @param The objects that make up the form
  * @return string
  */
 public function collection()
 {
     $args = func_get_args();
     $args = $this->__flatten($args);
     $rt = '';
     foreach ($args as $arg) {
         if (is_object($arg) && method_exists($arg, 'render')) {
             $rt .= $arg->render();
         } elseif (is_string($arg)) {
             $rt .= $arg;
         }
     }
     $r = '<form action="' . (empty($this->action) ? url(false, true) : (is_array($this->action) ? url($this->action) : $this->action)) . '" method="' . $this->method . '"' . (stripos($rt, 'type="file"') !== false ? ' enctype="multipart/form-data"' : '');
     if (!$this->id) {
         $r .= '>';
     } else {
         $r .= ' id="' . $this->id . '"><div style="display: none;"><input type="hidden" value="' . time() . '" name="' . $this->id . '" /></div>';
     }
     $r .= '<div class="formdiv">' . $rt . '</div>';
     if ($this->submittext !== false) {
         $r .= '<div class="submit">' . new Submit($this->submittext ? $this->submittext : __('Submit')) . '</div>';
     }
     $r .= '</form>';
     if ($this->validate) {
         JS::lib('jquery/jquery-validate/jquery.validate.min');
         JS::raw('$(function(){$("#' . $this->id . '").validate();});');
     }
     return $r;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:48,代码来源:Form.php

示例15: run

 function run()
 {
     global $Templates, $DB, $Controller;
     if (!$this->mayI(READ | EDIT)) {
         errorPage('401');
         return false;
     }
     $_REQUEST->setType('add', 'string');
     $_REQUEST->setType('edit', 'numeric');
     $_REQUEST->setType('del', 'numeric');
     $_REQUEST->setType('module', 'string');
     $_REQUEST->setType('type', 'string');
     $_REQUEST->setType('size', 'string');
     $_REQUEST->setType('content', 'string');
     $_REQUEST->setType('row', 'numeric');
     $_REQUEST->setType('place', 'numeric');
     //FIXME: Tillsvidare: Id på sidan som editeras
     $pID = 8;
     if ($_REQUEST['add']) {
         $newModule = $Controller->newObj('PageModule');
         $newModule->addData($pID, $_REQUEST['add']);
     } elseif ($_REQUEST['edit']) {
         $module = $Controller->{$_REQUEST['edit']};
         if ($_REQUEST['module']) {
             $module->module = $_REQUEST['module'];
         } elseif ($_REQUEST['size']) {
             $module->size = $_REQUEST['size'];
         } elseif ($_REQUEST['type']) {
             $module->type = $_REQUEST['type'];
         } elseif ($_REQUEST['row'] !== false && $_REQUEST['place'] !== false) {
             $module->move($_REQUEST['row'], $_REQUEST['place']);
         } elseif ($_REQUEST['content']) {
             $module->content = $_REQUEST['content'];
         }
     } elseif ($_REQUEST['del']) {
         $Controller->{$_REQUEST['del']}->delete();
     }
     /* Get numbers of rows on page*/
     $rowNum = $DB->pagelayout->getCell(array('pid' => $pID), "MAX(ROW)");
     $pagecontent = false;
     /* Get modules from each row */
     for ($row = 0; $row <= $rowNum; $row++) {
         $moduleIDs = $DB->pagelayout->asList(array('pid' => $pID, 'row' => $row), 'id', false, false, 'place');
         $rowContent = array();
         foreach ($moduleIDs as $mID) {
             $moduleObj = $Controller->{$mID};
             $rowContent[] = $moduleObj;
         }
         $pagecontent[$row] = $rowContent;
     }
     JS::loadjQuery();
     JS::lib('pagelayoutedit');
     $this->header = __('Page Layout');
     $this->setContent('main', '<h1>Page Layout</h1>' . $this->displayEditor($pagecontent));
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:56,代码来源:PageLayoutEditor.php


注:本文中的JS::lib方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。