本文整理汇总了PHP中JS类的典型用法代码示例。如果您正苦于以下问题:PHP JS类的具体用法?PHP JS怎么用?PHP JS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addJS
function _addJS($order, $resource, $is_file, $minify, $header)
{
$order = intval($order);
$resources = array();
if (array_key_exists($order, $this->js_resources)) {
$resources = $this->js_resources[$order];
}
$js = new JS($resource, $is_file);
$js->setMinified($minify);
$js->setInHead($header);
$resources[] = $js;
$this->js_resources[$order] = $resources;
}
示例2: getCover
/**
* Вывод обложки для 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;
}
示例3: getData
/**
* Get the replacement content for the placeholder
* @param string $placeholder
* @return string
*/
function getData($placeholder)
{
global $objDatabase;
\JS::activate("shadowbox", array('players' => array('html', 'iframe')));
$matter = substr($placeholder, 6, -1);
if ($matter == "OVERVIEW") {
return $this->getOverview();
}
// get the data id for the placeholder
$query = "\n SELECT type, ref_id\n FROM " . DBPREFIX . "module_data_placeholders\n WHERE placeholder='{$matter}'";
$objRs = $objDatabase->Execute($query);
if ($objRs && $objRs->RecordCount()) {
$id = $objRs->fields['ref_id'];
if ($objRs->fields['type'] == "cat") {
$this->_arrLanguages = $this->createLanguageArray();
$this->arrCategories = $this->createCategoryArray();
if ($this->arrCategories[$id]['action'] == "subcategories") {
return $this->getSubcategories($id);
}
return $this->getCategory($id);
} else {
return $this->getDetail($id);
}
}
return '';
}
示例4: initUploader
/**
* Init the uploader which is directly included in the webpage
*
* @return integer the uploader id
*/
protected function initUploader()
{
\JS::activate('cx');
// the uploader needs the framework
$uploader = new \Cx\Core_Modules\Uploader\Model\Entity\Uploader();
//create an uploader
$uploadId = $uploader->getId();
$uploader->setCallback('fileSharingUploader');
$uploader->setOptions(array('id' => 'fileSharing_' . $uploadId, 'style' => 'display:none;'));
$folderWidget = new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($_SESSION->getTempPath() . '/' . $uploadId, true);
$folderWidgetId = $folderWidget->getId();
$extendedFileInputCode = <<<CODE
<script type="text/javascript">
cx.ready(function() {
var field = jQuery('#contactForm #file_upload');
//called if user clicks on the field
var inputClicked = function() {
jQuery('#fileSharing_{$uploadId}').trigger('click');
return false;
};
jQuery('#fileSharing_{$uploadId}').hide();
field.bind('click', inputClicked).removeAttr('disabled');
});
//uploader javascript callback function
function fileSharingUploader(callback) {
angular.element('#mediaBrowserfolderWidget_{$folderWidgetId}').scope().refreshBrowser();
}
</script>
CODE;
$this->objTemplate->setVariable(array('UPLOADER_CODE' => $uploader->getXHtml(), 'FILE_INPUT_CODE' => $extendedFileInputCode, 'FOLDER_WIDGET_CODE' => $folderWidget->getXHtml()));
return $uploadId;
// return the upload id
}
示例5: render
/**
* Outputs the code and content for the accordion
* @return string
*/
public function render()
{
global $SITE, $CONFIG;
JS::loadjQuery();
JS::raw('$(function() {$(".ui-accordion-container").accordion({ header: "h3" ' . ($this->params ? ',' . $this->params : '') . '});});');
Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
Head::add('.ui-accordion-container li {width: 100%;}', 'css-raw');
$r = '<ol class="ui-accordion-container">';
$mode = 0;
$title = false;
$selected = false;
$i = 0;
foreach ($this->tabs as $arg) {
if ($mode == 0) {
$title = $arg;
$mode = 1;
} else {
$r .= '
<li>
<h3><a href="#">' . $title . '</a></h3>
<div>' . $arg . '</div>
</li>';
$mode = 0;
$selected = false;
$title = false;
$i++;
}
}
return $r . '</ol>';
}
示例6: run
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;
}
示例7: __construct
/**
* Checks environment and build defaults
*
*/
protected function __construct()
{
// Instantiate Feature Manager
FeatureManager::getInstance();
// Instantiate Context Manager
ContextManager::getInstance();
// Instantiate URLs Manager
UrlManager::getInstance();
// Instantiate Paths Manager & set Bebop root directory
PathManager::getInstance()->set('bebop', __DIR__);
// Set default Media Mvc Model modifications on the Bebop HTTP API
Media::onContext('api', function ($media) {
$media->cacheAllImageSizes();
});
// Set default views directory
View::setViewsDir(PathManager::getInstance()->get('theme', 'views'));
// Instantiate CSS Manager
CSS::getInstance();
// Instantiate JS Manager
JS::getInstance();
// Instantiate UI
UI::getInstance();
// Instantiate Api
self::Api();
// Instantiate Config
Config::getInstance();
// Shortcode support for in editor use
add_shortcode('Bebop', array($this, '__bebopShortcodes'));
}
示例8: getPage
/**
* Reads the act and selects the right action
*/
function getPage()
{
if (empty($_GET['cmd'])) {
$_GET['cmd'] = '';
} else {
$this->strCmd = '&cmd=' . intval($_GET['cmd']);
}
\JS::activate('shadowbox');
if (isset($_GET['pId']) && !empty($_GET['pId'])) {
if (isset($_POST['frmGalComAdd_PicId'])) {
$this->addComment();
\Cx\Core\Csrf\Controller\Csrf::header('location:' . CONTREXX_DIRECTORY_INDEX . '?section=Gallery' . html_entity_decode($this->strCmd, ENT_QUOTES, CONTREXX_CHARSET) . '&cid=' . intval($_POST['frmGalComAdd_GalId']) . '&pId=' . intval($_POST['frmGalComAdd_PicId']));
exit;
}
if (isset($_GET['mark'])) {
$this->countVoting($_GET['pId'], $_GET['mark']);
\Cx\Core\Csrf\Controller\Csrf::header('location:' . CONTREXX_DIRECTORY_INDEX . '?section=Gallery' . html_entity_decode($this->strCmd, ENT_QUOTES, CONTREXX_CHARSET) . '&cid=' . intval($_GET['cid']) . '&pId=' . intval($_GET['pId']));
exit;
}
if ($this->arrSettings['enable_popups'] == "on") {
$this->showPicture(intval($_GET['pId']));
} else {
$this->showPictureNoPop(intval($_GET['pId']));
}
} else {
$_GET['cid'] = isset($_GET['cid']) ? intval($_GET['cid']) : intval($_GET['cmd']);
$this->showCategoryOverview($_GET['cid']);
}
return $this->_objTpl->get();
}
示例9: load
/**
* Load your component.
*
* @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page
*/
public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
{
global $subMenuTitle, $_CORELANG, $objTemplate;
switch ($this->cx->getMode()) {
case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
$objKnowledge = new Knowledge(\Env::get('cx')->getPage()->getContent());
\Env::get('cx')->getPage()->setContent($objKnowledge->getPage());
if (!empty($objKnowledge->pageTitle)) {
\Env::get('cx')->getPage()->setTitle($objKnowledge->pageTitle);
\Env::get('cx')->getPage()->setContentTitle($objKnowledge->pageTitle);
\Env::get('cx')->getPage()->setMetaTitle($objKnowledge->pageTitle);
}
break;
case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
$this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
$objTemplate = $this->cx->getTemplate();
if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory() . '/View/Style/backend.css'))) {
\JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/backend.css', 1));
}
\Permission::checkAccess(129, 'static');
$subMenuTitle = $_CORELANG['TXT_KNOWLEDGE'];
$objKnowledge = new KnowledgeAdmin();
$objKnowledge->getPage();
break;
}
}
示例10: initFrontendEditing
/**
* Init the frontend editing.
*
* Register the javascripts and css files
* Adds the used language variables to contrexx-js variables, so the toolbar has access to these variables
*
* @param ComponentController $componentController
*/
public function initFrontendEditing(\Cx\Core_Modules\FrontendEditing\Controller\ComponentController $componentController)
{
global $_ARRAYLANG;
// get necessary objects
$objInit = \Env::get('init');
$page = $this->cx->getPage();
// add css and javascript file
$jsFilesRoot = substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Script', 1);
\JS::registerCSS(substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Style/Main.css', 1));
\JS::registerJS($jsFilesRoot . '/Main.js');
\JS::activate('cx');
// not used for contrexx version 3.1
// \JS::registerJS($jsFilesRoot . '/CKEditorPlugins.js');
// activate ckeditor
\JS::activate('ckeditor');
\JS::activate('jquery-cookie');
// load language data
$_ARRAYLANG = $objInit->loadLanguageData('FrontendEditing');
$langVariables = array('TXT_FRONTEND_EDITING_SHOW_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SHOW_TOOLBAR'], 'TXT_FRONTEND_EDITING_HIDE_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_HIDE_TOOLBAR'], 'TXT_FRONTEND_EDITING_PUBLISH' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISH'], 'TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE'], 'TXT_FRONTEND_EDITING_REFUSE_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_REFUSE_RELEASE'], 'TXT_FRONTEND_EDITING_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE'], 'TXT_FRONTEND_EDITING_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_EDIT'], 'TXT_FRONTEND_EDITING_CANCEL_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CANCEL_EDIT'], 'TXT_FRONTEND_EDITING_FINISH_EDIT_MODE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_FINISH_EDIT_MODE'], 'TXT_FRONTEND_EDITING_THE_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_THE_DRAFT'], 'TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE'], 'TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE'], 'TXT_FRONTEND_EDITING_MODULE_PAGE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_MODULE_PAGE'], 'TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT'], 'TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT'], 'TXT_FRONTEND_EDITING_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_DRAFT'], 'TXT_FRONTEND_EDITING_PUBLISHED' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISHED']);
// add toolbar to html
$this->prepareTemplate($componentController);
// assign js variables
$contrexxJavascript = \ContrexxJavascript::getInstance();
$contrexxJavascript->setVariable('langVars', $langVariables, 'FrontendEditing');
$contrexxJavascript->setVariable('pageId', $page->getId(), 'FrontendEditing');
$contrexxJavascript->setVariable('hasPublishPermission', \Permission::checkAccess(78, 'static', true), 'FrontendEditing');
$contrexxJavascript->setVariable('contentTemplates', $this->getCustomContentTemplates(), 'FrontendEditing');
$contrexxJavascript->setVariable('defaultTemplate', $this->getDefaultTemplate(), 'FrontendEditing');
$configPath = ASCMS_PATH_OFFSET . substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT));
$contrexxJavascript->setVariable('configPath', $configPath . '?langId=' . FRONTEND_LANG_ID, 'FrontendEditing');
}
示例11: init
/**
* Reescreve o método init()
* @access public
* @param void
* @return void
*/
public function init()
{
// verifica as permissoes
$PermissoesGrupo = array();
$auth = Zend_Auth::getInstance();
// instancia da autenticação
$GrupoAtivo = new Zend_Session_Namespace('GrupoAtivo');
$idPronac = $this->_request->getParam("idPronac");
// pega o id do pronac via get
if (strlen($idPronac) > 7) {
$idPronac = Seguranca::dencrypt($idPronac);
}
if (isset($auth->getIdentity()->usu_codigo)) {
parent::perfil(1, $PermissoesGrupo);
} else {
parent::perfil(4, $PermissoesGrupo);
$this->getIdUsuario = isset($_GET["idusuario"]) ? $_GET["idusuario"] : 0;
/* =============================================================================== */
/* ==== VERIFICA PERMISSAO DE ACESSO DO PROPONENTE A PROPOSTA OU AO PROJETO ====== */
/* =============================================================================== */
if (!isset($idPronac) || empty($idPronac)) {
parent::message('É necessário o número do PRONAC para acessar essa página!', "principalproponente", "ERROR");
}
// $this->verificarPermissaoAcesso(false, true, false);
}
//SE CAIU A SECAO REDIRECIONA
if (!$auth->hasIdentity()) {
$url = Zend_Controller_Front::getInstance()->getBaseUrl();
JS::redirecionarURL($url);
}
parent::init();
// chama o init() do pai GenericControllerNew
}
示例12: fetch
public static function fetch()
{
if (!self::is_fetched()) {
JS::require_jquery();
JS::require_script("/" . FRAMEWORK_CORE_PATH . "js/jquery/screen_resolution.js");
}
}
示例13: init
/**
* Reescreve o método init()
* @access public
* @param void
* @return void
*/
public function init()
{
$PermissoesGrupo[] = 93;
// Coordenador de Parecerista
$PermissoesGrupo[] = 94;
// Parecerista
$PermissoesGrupo[] = 121;
// Técnico de Acompanhamento
$PermissoesGrupo[] = 129;
// Técnico de Acompanhamento
$PermissoesGrupo[] = 122;
// Coordenador de Acompanhamento
$PermissoesGrupo[] = 123;
// Coordenador Geral de Acompanhamento
$PermissoesGrupo[] = 128;
// Tecnico de Portaria
parent::perfil(1, $PermissoesGrupo);
$auth = Zend_Auth::getInstance();
// pega a autenticação
//SE CAIU A SECAO REDIRECIONA
if (!$auth->hasIdentity()) {
$url = Zend_Controller_Front::getInstance()->getBaseUrl();
JS::redirecionarURL($url);
}
$agente = GerenciarPautaReuniaoDAO::consultaAgenteUsuario($auth->getIdentity()->usu_codigo);
$this->view->agente = $agente['idAgente'];
$this->getIdUsuario = $agente['idAgente'];
$GrupoAtivo = new Zend_Session_Namespace('GrupoAtivo');
// cria a sessão com o grupo ativo
$this->getIdOrgao = $GrupoAtivo->codOrgao;
$this->codGrupo = $GrupoAtivo->codGrupo;
parent::init();
// chama o init() do pai GenericControllerNew
}
示例14: showImport
/**
* It displayes the import menu
*
* @return customer import screen
*/
function showImport()
{
global $_ARRAYLANG, $objDatabase;
\JS::activate('cx');
\JS::activate('jqueryui');
\JS::registerCSS('modules/Crm/View/Style/main.css');
\JS::registerJS('modules/Crm/View/Script/contactexport.js');
\JS::registerJS('lib/javascript/jquery.form.js');
\JS::registerJS('lib/javascript/jquery.tmpl.min.js');
\JS::registerJS('lib/javascript/jquery.base64.js');
\JS::registerJS('lib/javascript/jquery.format.js');
$objTpl = $this->_objTpl;
$objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', "module_{$this->moduleNameLC}_interface_import_options.html");
$objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName));
foreach ($this->_delimiter as $key => $value) {
$objTpl->setVariable(array('CRM_DELIMITER_VALUE' => $key, 'CRM_DELIMITER_TITLE' => $_ARRAYLANG[$value['placeholder']]));
$objTpl->parse('crm_delimiter');
}
foreach ($this->_enclosure as $key => $value) {
$objTpl->setVariable(array('CRM_ENCLOSURE_VALUE' => $key, 'CRM_ENCLOSURE_TITLE' => $_ARRAYLANG[$value['placeholder']]));
$objTpl->parse('crm_enclosure');
}
$options = array('upload-limit' => 1, 'id' => 'importUploader', 'style' => 'display:none;', 'allowed-extensions' => array('csv'));
$uploaderCode = $this->initUploader('uploadFinished', 'importCallbackJs', '', '', $options);
$redirectUrl = \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?cmd=Crm&act=getImportFilename');
$this->_objTpl->setVariable(array('COMBO_UPLOADER_CODE' => $uploaderCode, 'REDIRECT_URL' => $redirectUrl));
$objTpl->setVariable(array('TXT_CRM_TITLE_IMPORT_CONTACTS' => $_ARRAYLANG['TXT_CRM_TITLE_IMPORT_CONTACTS'], 'TXT_CRM_IMPORT_HEADER' => $_ARRAYLANG['TXT_CRM_IMPORT_HEADER'], 'TXT_CRM_IMPORT_NOTE' => $_ARRAYLANG['TXT_CRM_IMPORT_NOTE'], 'TXT_CRM_IMPORT_NOTE_DESCRIPTION' => $_ARRAYLANG['TXT_CRM_IMPORT_NOTE_DESCRIPTION'], 'TXT_CRM_CSV_SETTINGS' => $_ARRAYLANG['TXT_CRM_CSV_SETTINGS'], 'TXT_CRM_SKIP' => $_ARRAYLANG['TXT_CRM_SKIP'], 'TXT_CRM_OVERWRITE' => $_ARRAYLANG['TXT_CRM_OVERWRITE'], 'TXT_CRM_DUPLICATE' => $_ARRAYLANG['TXT_CRM_DUPLICATE'], 'TXT_CRM_CHOOSE_FILE' => $_ARRAYLANG['TXT_CRM_CHOOSE_FILE'], 'TXT_CRM_CSV_SEPARATOR' => $_ARRAYLANG['TXT_CRM_CSV_SEPARATOR'], 'TXT_CRM_CSV_ENCLOSURE' => $_ARRAYLANG['TXT_CRM_CSV_ENCLOSURE'], 'TXT_CRM_ON_DUPLICATES' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATES'], 'TXT_CRM_CHOOSE_CSV' => $_ARRAYLANG['TXT_CRM_CHOOSE_CSV'], 'TXT_CRM_ON_DUPLICATES_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATES_INFO'], 'TXT_CRM_ON_DUPLICATE_SKIP_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_SKIP_INFO'], 'TXT_CRM_ON_DUPLICATE_OVERWRITE_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_OVERWRITE_INFO'], 'TXT_CRM_ON_DUPLICATE_INFO' => $_ARRAYLANG['TXT_CRM_ON_DUPLICATE_INFO'], 'TXT_CRM_IGNORE_FIRST_ROW' => $_ARRAYLANG['TXT_CRM_IGNORE_FIRST_ROW'], 'TXT_CRM_CONTINUE' => $_ARRAYLANG['TXT_CRM_CONTINUE'], 'TXT_CRM_CANCEL' => $_ARRAYLANG['TXT_CRM_CANCEL'], 'TXT_CRM_VERIFY_FIELDS' => $_ARRAYLANG['TXT_CRM_VERIFY_FIELDS'], 'TXT_CRM_VERIFY_INFO' => $_ARRAYLANG['TXT_CRM_VERIFY_INFO'], 'TXT_CRM_FILE_COLUMN' => $_ARRAYLANG['TXT_CRM_FILE_COLUMN'], 'TXT_CRM_CORRESPONDING_FIELD' => $_ARRAYLANG['TXT_CRM_CORRESPONDING_FIELD'], 'TXT_CRM_CSV_VALUE' => $_ARRAYLANG['TXT_CRM_CSV_VALUE'], 'TXT_CRM_CHANGE' => $_ARRAYLANG['TXT_CRM_CHANGE'], 'TXT_CRM_LOADING' => $_ARRAYLANG['TXT_CRM_LOADING'], 'TXT_CRM_PREVIOUS_RECORD' => $_ARRAYLANG['TXT_CRM_PREVIOUS_RECORD'], 'TXT_CRM_NEXT_RECORD' => $_ARRAYLANG['TXT_CRM_NEXT_RECORD'], 'TXT_CRM_TITLE_SAVING_CONTACTS' => $_ARRAYLANG['TXT_CRM_TITLE_SAVING_CONTACTS'], 'TXT_CRM_INTERFACE_FINAL_INFO' => $_ARRAYLANG['TXT_CRM_INTERFACE_FINAL_INFO'], 'TXT_CRM_RECORD_DONE' => $_ARRAYLANG['TXT_CRM_RECORD_DONE'], 'TXT_CRM_RECORD_SKIPPED' => $_ARRAYLANG['TXT_CRM_RECORD_SKIPPED'], 'TXT_CRM_RECORD_IMPORT' => $_ARRAYLANG['TXT_CRM_RECORD_IMPORT'], 'TXT_CRM_RECORD_PROCESS' => $_ARRAYLANG['TXT_CRM_RECORD_PROCESS'], 'TXT_CRM_IMPORT_NAME' => $_ARRAYLANG['TXT_CRM_IMPORT_NAME'], 'TXT_CRM_EXPORT_NAME' => $_ARRAYLANG['TXT_CRM_EXPORT_NAME']));
}
示例15: initUploader
/**
* init the pl uploader which is directly included in the webpage
*
* @return integer the uploader id
*/
protected function initUploader()
{
\JS::activate('cx');
// the uploader needs the framework
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
\Env::get('ClassLoader')->loadFile($cx->getCodeBaseCoreModulePath() . '/Upload/Controller/UploadFactory.class.php');
/**
* Name of the upload instance
*/
$uploaderInstanceName = 'exposed_combo_uploader';
$uploaderWidgetName = 'uploadWidget';
/**
* jQuery selector of the HTML-element where the upload folder-widget shall be put in
*/
$uploaderFolderWidgetContainer = '#uploadFormField_uploadWidget';
// create an exposedCombo uploader
$uploader = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newUploader('exposedCombo');
//set instance name so we are able to catch the instance with js
$uploader->setJsInstanceName($uploaderInstanceName);
// specifies the function to call when upload is finished. must be a static function
$uploader->setFinishedCallback(array($cx->getCodeBaseModulePath() . '/FileSharing/Controller/FileSharing.class.php', '\\Cx\\Modules\\FileSharing\\Controller\\FileSharing', 'uploadFinished'));
//insert the uploader into the HTML-template
$this->objTemplate->setVariable(array('UPLOADER_CODE' => $uploader->getXHtml(), 'EXTENDED_FILE_INPUT_CODE' => <<<CODE
<script type="text/javascript">
cx.include(
[
'core_modules/Upload/js/uploaders/exposedCombo/extendedFileInput.js'
],
function() {
var ef = new ExtendedFileInput({
field: \$J('#file_upload'),
instance: '{$uploaderInstanceName}',
widget: '{$uploaderWidgetName}'
});
}
);
cx.jQuery(document).ready(function(\$) {
\$J('a.toggle').click(function() {
\$J('div.toggle').toggle();
return false;
});
});
</script>
CODE
));
// optional: initialize the widget displaying the folder contents
$uploadId = $uploader->getUploadId();
$tempPaths = self::getTemporaryFilePaths($uploadId);
if (!is_dir($tempPaths[0] . '/' . $tempPaths[2])) {
\Cx\Lib\FileSystem\FileSystem::make_folder($tempPaths[0] . '/' . $tempPaths[2]);
//mkdir($tempPaths[0] . '/' . $tempPaths[2]);
\Cx\Lib\FileSystem\FileSystem::makeWritable($tempPaths[0] . '/' . $tempPaths[2]);
//chmod($tempPaths[0] . '/' . $tempPaths[2], 0777);
}
$folderWidget = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newFolderWidget($tempPaths[0] . '/' . $tempPaths[2], $uploaderInstanceName);
$this->objTemplate->setVariable('UPLOAD_WIDGET_CODE', $folderWidget->getXHtml($uploaderFolderWidgetContainer, 'uploadWidget'));
// return the upload id
return $uploadId;
}