Ejemplo n.º 1
0
         $answer['msg'] = $language['connector.rights'];
     }
     break;
 case 'datatable':
 default:
     if ($action && $tvid) {
         // document exists?
         $res = $modx->db->select('*', $modx->getFullTableName('site_content'), 'id=' . $docid);
         if ($modx->db->getRecordCount($res)) {
             // document with docId editable?
             $docObj = $modx->getPageInfo($docid, 0, '*');
             if ($docObj) {
                 // get the settings for the multiTV
                 $tvSettings = $modx->getTemplateVar($tvid, '*', $docid, $docObj['published']);
                 if ($tvSettings && ($tvSettings['elements'] = '@INCLUDE' . MTV_PATH . 'multitv.customtv.php')) {
                     $multiTV = new multiTV($modx, array('type' => 'tv', 'tvDefinitions' => $tvSettings, 'tvUrl' => MTV_PATH));
                     $includeFile = $multiTV->includeFile($action, 'processor');
                     // processor available?
                     if ($includeFile) {
                         include $includeFile;
                     } else {
                         $answer['error'] = true;
                         $answer['msg'] = $language['connector.noprocessor'];
                     }
                 } else {
                     $answer['error'] = true;
                     $answer['msg'] = $language['connector.nomultitv'];
                 }
             } else {
                 $answer['error'] = true;
                 $answer['msg'] = $language['connector.rights'];
Ejemplo n.º 2
0
 *
 * @category    module
 * @version     2.0
 * @license     http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
 * @author      Jako (thomas.jakobi@partout.info)
 *
 * @internal    description: <strong>2.0</strong> Custom Template Variabe containing a sortable multi item list or a datatable and a datatable CRUD module.
 * @internal    module code: include(MODX_BASE_PATH.'assets/tvs/multitv/multitv.module.php');
 */
if (IN_MANAGER_MODE != 'true') {
    die('<h1>ERROR:</h1><p>Please use the MODx Content Manager instead of accessing this file directly.</p>');
}
global $modx;
// set customtv (base) path
define('MTV_PATH', str_replace(MODX_BASE_PATH, '', str_replace('\\', '/', realpath(dirname(__FILE__)))) . '/');
define('MTV_BASE_PATH', MODX_BASE_PATH . MTV_PATH);
// load classfile
$class_file = MTV_BASE_PATH . 'includes/multitv.class.php';
if (!file_exists($class_file)) {
    $modx->messageQuit(sprintf('Classfile "%s" not found. Did you upload the module files?', $class_file));
}
require_once $class_file;
$configs = isset($configs) ? array_map('trim', explode(',', $configs)) : array();
$options = array('moduleId' => (int) $_GET['id'], 'action' => isset($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'load', 'managerDir' => MGR_DIR . '/', 'tvUrl' => MTV_PATH, 'managerTheme' => $modx->config['manager_theme'], 'type' => 'module', 'modulename' => $_SESSION['itemname']);
$multiTV = new multiTV($modx, $options);
if ($configs) {
    $output = $multiTV->runModule($configs);
} else {
    $output = '<h3>Please specify at least one configuration in module config</h3>';
}
echo $output;
Ejemplo n.º 3
0
<?php

/**
 * multiTV
 *
 * @category    customtv
 * @version     2.0
 * @license     http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
 * @author      Jako (thomas.jakobi@partout.info)
 *
 * @internal    description: <strong>2.0</strong> Custom Template Variabe containing a sortable multi item list or a datatable.
 * @internal    input option code: @INCLUDE/assets/tvs/multitv/multitv.customtv.php
 */
if (IN_MANAGER_MODE != 'true') {
    die('<h1>ERROR:</h1><p>Please use the MODx Content Manager instead of accessing this file directly.</p>');
}
// set customtv (base) path
define('MTV_PATH', str_replace(MODX_BASE_PATH, '', str_replace('\\', '/', realpath(dirname(__FILE__)))) . '/');
define('MTV_BASE_PATH', MODX_BASE_PATH . MTV_PATH);
if (!class_exists('multiTV')) {
    include MTV_BASE_PATH . 'includes/multitv.class.php';
}
$multiTV = new multiTV($modx, array('type' => 'tv', 'tvDefinitions' => $row, 'tvUrl' => MTV_PATH));
echo $multiTV->generateScript();
Ejemplo n.º 4
0
// load template variable settings
$tvName = isset($tvName) ? $tvName : '';
$fromJson = isset($fromJson) ? $fromJson : '';
if (!empty($fromJson)) {
    $tvSettings = array('name' => $tvName, 'value' => $fromJson);
} else {
    $res = $modx->db->select('*', $modx->getFullTableName('site_tmplvars'), 'name="' . $tvName . '"');
    $tvSettings = $modx->db->getRow($res);
}
if (!$tvSettings) {
    return 'Template variable ' . $tvName . ' does not exists or parameter fromJson empty.';
}
// pre-init template configuration
$tvSettings['tpl_config'] = isset($tplConfig) ? $tplConfig : '';
// init multiTV class
$multiTV = new multiTV($modx, array('type' => 'tv', 'tvDefinitions' => $tvSettings, 'tvUrl' => MTV_PATH));
$templates = $multiTV->templates;
// get snippet parameter
$params = array();
$params['docid'] = isset($docid) ? $docid : $modx->documentObject['id'];
$params['outerTpl'] = isset($outerTpl) ? $outerTpl : (isset($templates['outerTpl']) ? '@CODE:' . $templates['outerTpl'] : '@CODE:<select name="' . $tvName . '">[+wrapper+]' . (isset($paginate) && $paginate ? '[+pagination+]' : '') . '</select>');
$params['emptyOutput'] = isset($emptyOutput) && !$emptyOutput ? false : true;
$params['noResults'] = isset($noResults) ? $noResults : '';
$params['rowTpl'] = isset($rowTpl) ? $rowTpl : (isset($templates['rowTpl']) ? '@CODE:' . $templates['rowTpl'] : '@CODE:<option value="[+value+]">[+key+]</option>');
$params['display'] = isset($display) ? $display : 5;
$params['offset'] = isset($offset) ? intval($offset) : 0;
$params['rows'] = isset($rows) && $rows != 'all' ? explode(',', $rows) : 'all';
$params['toPlaceholder'] = isset($toPlaceholder) && $toPlaceholder != '' ? $toPlaceholder : false;
$params['toJson'] = isset($toJson) && $toJson != '' ? $toJson : false;
$params['randomize'] = isset($randomize) && $randomize ? true : false;
$params['reverse'] = isset($reverse) && $reverse ? true : false;