function renderDocGroups()
 {
     $documentgroups = $this->modx->db->select('id,name', $this->modx->getFullTableName('documentgroup_names'), '', 'id ASC');
     $grd = new DataGrid('', $documentgroups);
     $grd->noRecordMsg = $this->dm->lang['DM_doc_no_docs'];
     $grd->cssClass = "grid";
     $grd->columnHeaderClass = "gridHeader";
     $grd->itemClass = "gridItem";
     $grd->altItemClass = "gridAltItem";
     $grd->columns = " ," . $this->dm->lang['DM_doc_column_id'] . "," . $this->dm->lang['DM_doc_column_name'];
     $grd->colTypes = "template:<input type='radio' name='docgroupid' value='[+id+]' />";
     $grd->colWidths = "5%,5%,40%,50%";
     $grd->fields = "template,id,name";
     $this->dm->ph['documentgroups.grid'] = $grd->render();
     $this->dm->ph['view.documentgroups'] = $this->dm->parseTemplate('documentgroups.tpl', $this->dm->ph);
 }
 function getHTMLGrid($dsq, $params)
 {
     if (!is_object($dsq)) {
         $dsq = $this->query($dsq);
     }
     if ($dsq) {
         include_once MODX_MANAGER_PATH . 'includes/controls/datagrid.class.php';
         $grd = new DataGrid('', $dsq);
         $grd->noRecordMsg = $params['noRecordMsg'];
         $grd->columnHeaderClass = $params['columnHeaderClass'];
         $grd->cssClass = $params['cssClass'];
         $grd->itemClass = $params['itemClass'];
         $grd->altItemClass = $params['altItemClass'];
         $grd->columnHeaderStyle = $params['columnHeaderStyle'];
         $grd->cssStyle = $params['cssStyle'];
         $grd->itemStyle = $params['itemStyle'];
         $grd->altItemStyle = $params['altItemStyle'];
         $grd->columns = $params['columns'];
         $grd->fields = $params['fields'];
         $grd->colWidths = $params['colWidths'];
         $grd->colAligns = $params['colAligns'];
         $grd->colColors = $params['colColors'];
         $grd->colTypes = $params['colTypes'];
         $grd->colWraps = $params['colWraps'];
         $grd->cellPadding = $params['cellPadding'];
         $grd->cellSpacing = $params['cellSpacing'];
         $grd->header = $params['header'];
         $grd->footer = $params['footer'];
         $grd->pageSize = $params['pageSize'];
         $grd->pagerLocation = $params['pagerLocation'];
         $grd->pagerClass = $params['pagerClass'];
         $grd->pagerStyle = $params['pagerStyle'];
         return $grd->render();
     }
 }
    }
    $where .= "(source LIKE '%{$search}%') OR (description LIKE '%{$search}%')";
}
$orderby = 'el.id DESC';
$ds = $modx->db->select($field, $from, $where, $orderby);
include_once $base_path . "manager/includes/controls/datagrid.class.php";
$grd = new DataGrid('', $ds, $number_of_results);
// set page size to 0 t show all items
$grd->noRecordMsg = $_lang['no_records_found'];
$grd->cssClass = "grid";
$grd->columnHeaderClass = "gridHeader";
$grd->itemClass = "gridItem";
$grd->altItemClass = "gridAltItem";
$grd->fields = "type,source,createdon,eventid,username";
$grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid'];
$grd->colWidths = "34,,150,60";
$grd->colAligns = "center,,,center,center";
$grd->colTypes = "template:<a class='gridRowIcon' href='#' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><img src='media/style/" . $manager_theme . "/images/icons/event[+type+].png' /></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %H:%M:%S';
if ($listmode == '1') {
    $grd->pageSize = 0;
}
if ($_REQUEST['op'] == 'reset') {
    $grd->pageNumber = 1;
}
// render grid
echo $grd->render();
?>
	</div>
</div>
</form>
function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '')
{
    global $modx;
    // process any TV commands in value
    $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier;
    $value = ProcessTVCommand($value, $name, $docid);
    $params = array();
    if ($paramstring) {
        $cp = explode("&", $paramstring);
        foreach ($cp as $p => $v) {
            $v = trim($v);
            // trim
            $ar = explode("=", $v);
            if (is_array($ar) && count($ar) == 2) {
                $params[$ar[0]] = decodeParamValue($ar[1]);
            }
        }
    }
    $id = "tv{$name}";
    switch ($format) {
        case 'image':
            $images = parseInput($value, '||', 'array');
            $o = '';
            foreach ($images as $image) {
                if (!is_array($image)) {
                    $image = explode('==', $image);
                }
                $src = $image[0];
                if ($src) {
                    // We have a valid source
                    $attributes = '';
                    $attr = array('class' => $params['class'], 'src' => $src, 'id' => $params['id'] ? $params['id'] : '', 'alt' => htmlspecialchars($params['alttext']), 'style' => $params['style']);
                    if (isset($params['align']) && $params['align'] != 'none') {
                        $attr['align'] = $params['align'];
                    }
                    foreach ($attr as $k => $v) {
                        $attributes .= $v ? ' ' . $k . '="' . $v . '"' : '';
                    }
                    $attributes .= ' ' . $params['attrib'];
                    // Output the image with attributes
                    $o .= '<img' . rtrim($attributes) . ' />';
                }
            }
            break;
        case "delim":
            // display as delimitted list
            $value = parseInput($value, "||");
            $p = $params['format'] ? $params['format'] : " ";
            if ($p == "\\n") {
                $p = "\n";
            }
            $o = str_replace("||", $p, $value);
            break;
        case "string":
            $value = parseInput($value);
            $format = strtolower($params['format']);
            if ($format == 'upper case') {
                $o = strtoupper($value);
            } else {
                if ($format == 'lower case') {
                    $o = strtolower($value);
                } else {
                    if ($format == 'sentence case') {
                        $o = ucfirst($value);
                    } else {
                        if ($format == 'capitalize') {
                            $o = ucwords($value);
                        } else {
                            $o = $value;
                        }
                    }
                }
            }
            break;
        case "date":
            if ($value != '' || $params['default'] == 'Yes') {
                $timestamp = getUnixtimeFromDateString($value);
                $p = $params['format'] ? $params['format'] : "%A %d, %B %Y";
                $o = strftime($p, $timestamp);
            } else {
                $value = '';
            }
            break;
        case "floater":
            $value = parseInput($value, " ");
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/mootools.js", array('name' => 'mootools', 'version' => '1.1.1', 'plaintext' => false));
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/moodx.js", array('name' => 'moodx', 'version' => '0', 'plaintext' => false));
            $class = !empty($params['class']) ? " class=\"" . $params['class'] . "\"" : "";
            $style = !empty($params['style']) ? " style=\"" . $params['style'] . "\"" : "";
            $o .= "\n<div id=\"" . $id . "\"" . $class . $style . ">" . $value . "</div>\n";
            $o .= "<script type=\"text/javascript\">\n";
            $o .= "\twindow.addEvent('domready', function(){\n";
            $o .= "\t\tvar modxFloat = new MooFloater(\$(\"" . $id . "\"),{\n";
            $o .= "\t\t\twidth: '" . $params['width'] . "',\n";
            $o .= "\t\t\theight: '" . $params['height'] . "',\n";
            $o .= "\t\t\tposition: '" . $params['pos'] . "',\n";
            $o .= "\t\t\tglidespeed: " . $params['gs'] . ",\n";
            $o .= "\t\t\toffsetx: " . intval($params['x']) . ",\n";
            $o .= "\t\t\toffsety: " . intval($params['y']) . "\n";
            $o .= "\t\t});\n";
            $o .= "\t});\n";
            $o .= "</script>\n";
            break;
        case "marquee":
            $value = parseInput($value, " ");
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/mootools.js", array('name' => 'mootools', 'version' => '1.1.1', 'plaintext' => false));
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/moodx.js", array('name' => 'moodx', 'version' => '0', 'plaintext' => false));
            $class = !empty($params['class']) ? " class=\"" . $params['class'] . "\"" : "";
            $style = !empty($params['style']) ? " style=\"" . $params['style'] . "\"" : "";
            $o .= "\n<div id=\"" . $id . "\"" . $class . $style . "><div id=\"marqueeContent\">" . $value . "</div></div>\n";
            $o .= "<script type=\"text/javascript\">\n";
            $o .= "\twindow.addEvent('domready', function(){\n";
            $o .= "\t\tvar modxMarquee = new MooMarquee(\$(\"" . $id . "\"),{\n";
            $o .= "\t\t\twidth: '" . $params['width'] . "',\n";
            $o .= "\t\t\theight: '" . $params['height'] . "',\n";
            $o .= "\t\t\tspeed: " . $params['speed'] . ",\n";
            $o .= "\t\t\tmodifier: " . $params['modifier'] . ",\n";
            $o .= "\t\t\tmousepause: '" . $params['pause'] . "',\n";
            $o .= "\t\t\tdirection: '" . $params['tfx'] . "'\n";
            $o .= "\t\t});\n";
            $o .= "\t});\n";
            $o .= "</script>\n";
            break;
        case "ticker":
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/mootools.js", array('name' => 'mootools', 'version' => '1.1.1', 'plaintext' => false));
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/mootools/moostick.js?init=false", array('name' => 'moostick', 'version' => '0', 'plaintext' => false));
            $class = !empty($params['class']) ? " class=\"" . $params['class'] . "\"" : "";
            $style = !empty($params['style']) ? " style=\"" . $params['style'] . "\"" : "";
            $o .= "\n<div id=\"" . $id . "\"" . $class . $style . ">\n";
            if (!empty($value)) {
                $delim = $params['delim'] ? $params['delim'] : "||";
                if ($delim == "\\n") {
                    $delim = "\n";
                }
                $val = parseInput($value, $delim, "array", false);
                if (count($val) > 0) {
                    $o .= "    <ul id=\"" . $id . "Ticker\">\n";
                    for ($i = 0; $i < count($val); $i++) {
                        $o .= "        <li id=\"tickerItem{$i}\">" . $val[$i] . "</li>\n";
                    }
                    $o .= "    </ul>\n";
                }
            }
            $o .= "</div>\n";
            $o .= "<script type=\"text/javascript\">\n";
            $o .= "\twindow.addEvent('domready', function(){\n";
            $o .= "\t\tvar modxTicker = new Moostick(\$(\"" . $id . "Ticker\"), true, " . (!empty($params['delay']) ? $params['delay'] : "true") . ")\n";
            $o .= "\t\t\$(\"" . $id . "Ticker\").setStyle('width','" . $params['width'] . "');\n";
            $o .= "\t\t\$(\"" . $id . "Ticker\").setStyle('height','" . $params['height'] . "');\n";
            $o .= "\t});\n";
            $o .= "</script>\n";
            break;
        case "hyperlink":
            $value = parseInput($value, "||", "array");
            for ($i = 0; $i < count($value); $i++) {
                list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]);
                if (!$url) {
                    $url = $name;
                }
                if ($url) {
                    if ($o) {
                        $o .= '<br />';
                    }
                    $attributes = '';
                    // setup the link attributes
                    $attr = array('href' => $url, 'title' => $params['title'] ? htmlspecialchars($params['title']) : $name, 'class' => $params['class'], 'style' => $params['style'], 'target' => $params['target']);
                    foreach ($attr as $k => $v) {
                        $attributes .= $v ? ' ' . $k . '="' . $v . '"' : '';
                    }
                    $attributes .= ' ' . $params['attrib'];
                    // add extra
                    // Output the link
                    $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? htmlspecialchars($params['text']) : $name) . '</a>';
                }
            }
            break;
        case "htmltag":
            $value = parseInput($value, "||", "array");
            $tagid = $params['tagid'];
            $tagname = $params['tagname'] ? $params['tagname'] : 'div';
            // Loop through a list of tags
            for ($i = 0; $i < count($value); $i++) {
                $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i];
                if (!$tagvalue) {
                    continue;
                }
                $attributes = '';
                $attr = array('id' => $tagid ? $tagid : $id, 'class' => $params['class'], 'style' => $params['style']);
                foreach ($attr as $k => $v) {
                    $attributes .= $v ? ' ' . $k . '="' . $v . '"' : '';
                }
                $attributes .= ' ' . $params['attrib'];
                // add extra
                // Output the HTML Tag
                $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
            }
            break;
        case "richtext":
            $value = parseInput($value);
            $w = $params['w'] ? $params['w'] : '100%';
            $h = $params['h'] ? $params['h'] : '400px';
            $richtexteditor = $params['edt'] ? $params['edt'] : "";
            $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
            $o .= htmlspecialchars($value);
            $o .= '</textarea></div>';
            $replace_richtext = array($id);
            // setup editors
            if (!empty($replace_richtext) && !empty($richtexteditor)) {
                // invoke OnRichTextEditorInit event
                $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array('editor' => $richtexteditor, 'elements' => $replace_richtext, 'forfrontend' => 1, 'width' => $w, 'height' => $h));
                if (is_array($evtOut)) {
                    $o .= implode("", $evtOut);
                }
            }
            break;
        case "unixtime":
            $value = parseInput($value);
            $o = getUnixtimeFromDateString($value);
            break;
        case "viewport":
            $value = parseInput($value);
            $id = '_' . time();
            if (!$params['vpid']) {
                $params['vpid'] = $id;
            }
            $sTag = "<iframe";
            $eTag = "</iframe>";
            $autoMode = "0";
            $w = $params['width'];
            $h = $params['height'];
            if ($params['stretch'] == 'Yes') {
                $w = "100%";
                $h = "100%";
            }
            if ($params['asize'] == 'Yes' || $params['awidth'] == 'Yes' && $params['aheight'] == 'Yes') {
                $autoMode = "3";
                //both
            } else {
                if ($params['awidth'] == 'Yes') {
                    $autoMode = "1";
                    //width only
                } else {
                    if ($params['aheight'] == 'Yes') {
                        $autoMode = "2";
                        //height only
                    }
                }
            }
            $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array('name' => 'viewport', 'version' => '0', 'plaintext' => false));
            $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
            if ($params['class']) {
                $o .= " class='" . $params['class'] . "' ";
            }
            if ($params['style']) {
                $o .= " style='" . $params['style'] . "' ";
            }
            if ($params['attrib']) {
                $o .= $params['attrib'] . " ";
            }
            $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
            $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
            $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
            $o .= ">";
            $o .= $eTag;
            break;
        case "datagrid":
            include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
            $grd = new DataGrid('', $value);
            $grd->noRecordMsg = $params['egmsg'];
            $grd->columnHeaderClass = $params['chdrc'];
            $grd->cssClass = $params['tblc'];
            $grd->itemClass = $params['itmc'];
            $grd->altItemClass = $params['aitmc'];
            $grd->columnHeaderStyle = $params['chdrs'];
            $grd->cssStyle = $params['tbls'];
            $grd->itemStyle = $params['itms'];
            $grd->altItemStyle = $params['aitms'];
            $grd->columns = $params['cols'];
            $grd->fields = $params['flds'];
            $grd->colWidths = $params['cwidth'];
            $grd->colAligns = $params['calign'];
            $grd->colColors = $params['ccolor'];
            $grd->colTypes = $params['ctype'];
            $grd->cellPadding = $params['cpad'];
            $grd->cellSpacing = $params['cspace'];
            $grd->header = $params['head'];
            $grd->footer = $params['foot'];
            $grd->pageSize = $params['psize'];
            $grd->pagerLocation = $params['ploc'];
            $grd->pagerClass = $params['pclass'];
            $grd->pagerStyle = $params['pstyle'];
            $o = $grd->render();
            break;
        case 'htmlentities':
            $value = parseInput($value);
            if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
                // remove delimiter from checkbox and listbox-multiple TVs
                $value = str_replace('||', '', $value);
            }
            $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']);
            break;
        case 'custom_widget':
            $widget_output = '';
            $o = '';
            /* If we are loading a file */
            if (substr($params['output'], 0, 5) == "@FILE") {
                $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
                if (!file_exists($file_name)) {
                    $widget_output = $file_name . ' does not exist';
                } else {
                    $widget_output = file_get_contents($file_name);
                }
            } elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
                $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
                if (!file_exists($file_name)) {
                    $widget_output = $file_name . ' does not exist';
                } else {
                    /* The included file needs to set $widget_output. Can be string, array, object */
                    include $file_name;
                }
            } elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') {
                $chunk_name = trim(substr($params['output'], 7));
                $widget_output = $modx->getChunk($chunk_name);
            } elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') {
                $eval_str = trim(substr($params['output'], 6));
                $widget_output = eval($eval_str);
            } elseif ($value !== '') {
                $widget_output = $params['output'];
            } else {
                $widget_output = '';
            }
            if (is_string($widget_output)) {
                $widget_output = str_replace('[+value+]', $value, $widget_output);
                $o = $modx->parseDocumentSource($widget_output);
            } else {
                $o = $widget_output;
            }
            break;
        default:
            $value = parseInput($value);
            if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') {
                // add separator
                $value = explode('||', $value);
                $value = implode($sep, $value);
            }
            $o = $value;
            break;
    }
    return $o;
}
	$col_count = count($col_fields);

	$grd = new DataGrid('',$ds,25); // page size needs to be setting!
	$grd->noRecordMsg = $_lang["no_records_found"];
	$grd->cssClass="grid";
	$grd->columnHeaderClass="gridHeader";
	$grd->itemClass="gridItem";
	$grd->altItemClass="gridAltItem";
	$grd->fields= implode(',',$col_fields).',del';
	$grd->columns = implode(',',$col_headers);
	$grd->colTypes ="template:<input type='checkbox' name='chk[]' value='[+value+]' />&nbsp;[+value+]";
	$grd->colWidths="55".str_repeat(',',$col_count);

	// render grid
	$html = $grd->render();
?>

	<script language="JavaScript" type="text/javascript">
	function cancelEdit(){
		document.location.href = '<?php echo $dbeHomeUrl ?>';
	}

	function restoreRecords(){
		f = $('mutate');
		if(f){
			f.ra.value = "restore";
			f.submit();
		}
	}
Exemple #6
0
}));
$Grid->addColumn(array("title" => "Nombres", "campo" => "nombres"));
$Grid->addColumn(array("title" => "Apellidos", "campo" => "apellidos", "fnCallback" => function ($fila, $row) {
    // se trata de un closure o función anónima, a la que accedemos por el indice (fnCallback)
    $cadena = $row['nombres'] . ' - ' . $row['apellidos'];
    return $cadena;
}));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres")), "fnCallback" => function ($fila, $row) {
    // se trata de un closure o función anónima, a la que accedemos por el indice (fnCallback)
    $cadena = $fila . '.- ' . $row['nombres'] . ' - ' . $row['apellidos'];
    return $cadena;
}));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres"))));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres"))));
$Grid->selectData(array("info" => true, "criterio" => $criterio, "class" => "ConsultarData", "method" => "getDataSP", "paginate" => array("ajax" => "index.getDatagrid", "page" => $page, "reg_x_pag" => $regxpag, "itemPaginas" => 10)));
echo $Grid->render();
/* Para comprobar la conexión
$d = new Connect();

$sql = 'select * from f_trabajador where genero = :genero';

$parametros = array(
	':genero' => 'M'
);

$stat = $d->prepare($sql);
$stat->execute($parametros);

$res = $stat->fetchAll(PDO::FETCH_ASSOC);

print_r($res);*/
Exemple #7
0
 /**
  * Get an HTML grid
  *
  * @access public
  * @param $params Data grid parameters         columnHeaderClass tableClass
  * itemClass         altItemClass columnHeaderStyle         tableStyle
  * itemStyle altItemStyle         columns         fields         colWidths
  * colAligns         colColors         colTypes         cellPadding
  * cellSpacing         header         footer         pageSize pagerLocation
  * pagerClass         pagerStyle
  * @return string
  */
 function getHTMLGrid($dsq, $params)
 {
     if (!is_resource($dsq)) {
         $dsq = $this->query($dsq);
     }
     if ($dsq) {
         $dsq = $dsq->fetchAll(PDO::FETCH_ASSOC);
         include_once MODX_BASE_PATH . "/manager/includes/controls/datagrid.class.php";
         $grd = new DataGrid('', $dsq);
         $grd->noRecordMsg = $params['noRecordMsg'];
         $grd->columnHeaderClass = $params['columnHeaderClass'];
         $grd->tableClass = $params['tableClass'];
         $grd->itemClass = $params['itemClass'];
         $grd->altItemClass = $params['altItemClass'];
         $grd->columnHeaderStyle = $params['columnHeaderStyle'];
         $grd->tableStyle = $params['tableStyle'];
         $grd->itemStyle = $params['itemStyle'];
         $grd->altItemStyle = $params['altItemStyle'];
         $grd->columns = $params['columns'];
         $grd->fields = $params['fields'];
         $grd->colWidths = $params['colWidths'];
         $grd->colAligns = $params['colAligns'];
         $grd->colColors = $params['colColors'];
         $grd->colTypes = $params['colTypes'];
         $grd->cellPadding = $params['cellPadding'];
         $grd->cellSpacing = $params['cellSpacing'];
         $grd->header = $params['header'];
         $grd->footer = $params['footer'];
         $grd->pageSize = $params['pageSize'];
         $grd->pagerLocation = $params['pagerLocation'];
         $grd->pagerClass = $params['pagerClass'];
         $grd->pagerStyle = $params['pagerStyle'];
         return $grd->render();
     }
 }
}
if (!(isset($dbConfig['settings']['hide_delete']) && $dbConfig['settings']['hide_delete'])) {
    $grd->columns .= ',Delete';
}
//compute templates/types
for ($f = 0; $f < $col_count; $f++) {
    $col_types[] = "template:<a style='display:block;' href=\"" . $dbeHomeUrl . "&rn=[+" . $key_field . "+]\" title=\"Click to view record\">[+value+]</a>";
}
if (isset($dbConfig['settings']['pdf_export']) && $dbConfig['settings']['pdf_export']) {
    $col_types[] = "template:<a href=\"/assets/modules/dbedit/exportpdf.php?export=" . $db_id . "&row=[+" . $key_field . "+]\t\"><img src=\"media/style/{$manager_theme}images/tree/application_pdf.png\"  align=\"absmiddle\" alt=\"PDF export\" /></a>";
}
if (!(isset($dbConfig['settings']['hide_delete']) && $dbConfig['settings']['hide_delete'])) {
    $col_types[] = "template:<a href=\"#\" onClick=\"deleteRecord('[+" . $key_field . "+]')\"><img src=\"media/style/{$manager_theme}images/icons/delete.png\"  align=\"absmiddle\" alt=\"delete\" /></a>";
}
$grd->colTypes = implode('||', $col_types);
$grid_html = $grd->render();
$js_script = <<<EOS
<script type="text/javascript">
function deleteRecord(id){
\turi = '{$dbeHomeUrl}&ra=delete&rn='+id;
\tif(confirm("Are you sure you want to delete record '" + id + "'")==true){
\t\twindow.location.href = uri;
\t}
}
function filterGrid(){
\tfld = \$('fldname').value;
\tif(!fld) return;
\tval = \$('dbe_search').value;
\turi = '{$dbeHomeUrl}&dbe_fld='+fld+'&dbe_filter='+val;
\twindow.location.href = uri;
}
Exemple #9
0
    $numRecords = $modx->db->getRecordCount($items_result);
    if ($numRecords) {
        $grd = new DataGrid('', $items_result);
        $grd->noRecordMsg = 'Нет заявок.';
        $grd->pageSize = $page_num;
        $grd->pagerLocation = 'bottom-left';
        $grd->cssClass = "grid";
        $grd->columnHeaderClass = "gridHeader";
        $grd->itemClass = "gridItem";
        $grd->altItemClass = "gridAltItem";
        $grd->columns = "ID,Наименование,Цена,Действия";
        $grd->colTypes = '
        ||template:<br /><a href="index.php?a=27&amp;update=[+id+]&amp;id=[+parent+]&amp;pid=[+parent+]&amp;to_shk=1" onclick="$.fn.colorbox.init();$.fn.colorbox($.extend(colorBoxOpt,{href:\'index.php?a=27&amp;update=[+id+]&amp;id=[+parent+]&amp;pid=[+parent+]&amp;to_shk=1\'})); return false;">[+pagetitle+]</a>
        ||template:<input type="hidden" name="prod_id[]" value="[+id+]" /> <input type="text" name="price[]" size="12" value="[+price+]" />
        ||template:<a href="#" title="' . $langTxt['delete'] . '" onclick="if(confirm(\'' . $langTxt['confirm'] . '\')){postForm(\'delete_item\',\'[+id+]\',null);}return false;"><img src="' . SHOPKEEPER_PATH . 'style/default/img/m_delete.gif" /></a>
        ';
        $grd->colWidths = "10%,50%,20%,20%";
        $grd->fields = "id,pagetitle,price";
        $data_table = $grd->render();
        //pagination
        $p = new pagination();
        $p->Items($total);
        $p->limit($page_num);
        $p->target($catalog_mod_page);
        $p->currentPage($curPage);
        $p->nextT = ' <a href="[+link+]">' . $langTxt['next'] . '</a> ';
        $p->prevT = ' <a href="[+link+]">' . $langTxt['prev'] . '</a> ';
        $pagination = $p->getOutput();
    }
}
include "templates/catalog.tpl.php";
});

</script>
</div>
';
    }
    if (isset($find) && strlen($find) > 0) {
        $output .= '

        ';
        $search = $modx->dbQuery("\n\n        select 'Site Content' as `type`,27 as action, sc.id,concat(sc.pagetitle,'(',sc.id,')') as pagetitle,'sc.content' as content from " . $modx->getFullTableName('site_content') . " sc where\n            sc.content like concat('%','" . $modx->db->escape($find) . "','%')\n            OR sc.pagetitle like concat('%','" . $modx->db->escape($find) . "','%')\n            OR sc.longtitle like concat('%','" . $modx->db->escape($find) . "','%')\n            OR sc.description like concat('%','" . $modx->db->escape($find) . "','%')\n            OR sc.introtext like concat('%','" . $modx->db->escape($find) . "','%')\n            OR sc.menutitle like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Module' as `type`,108 as action, md.id, md.name, 'md.modulecode' from " . $modx->getFullTableName('site_modules') . " md where md.modulecode like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Module (Configuration Parameter)' as `type`,108 as action, mcp.id, mcp.name,'mcp.properties' from " . $modx->getFullTableName('site_modules') . " mcp where mcp.properties like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Template' as `type`,16 as action, tpl.id, tpl.templatename, 'tpl.content' from " . $modx->getFullTableName('site_templates') . " tpl where tpl.content like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n        -- 301 for TV edit form, tv.id as ID\n        select 'Template Variable' as `type`,27 as action,sc.id,concat(tv.name,' - ',sc.pagetitle,'(',tval.contentid,')') as title,'tval.value' from\n            " . $modx->getFullTableName('site_tmplvar_contentvalues') . " tval\n\n            inner join " . $modx->getFullTableName('site_tmplvars') . " tv\n            on tv.id = tval.tmplvarid\n\n            left join " . $modx->getFullTableName('site_content') . " sc\n            on sc.id = tval.contentid\n\n        where tval.value like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Chunk' as `type`,78 as action,chk.id,chk.name,'chk.snippet' from " . $modx->getFullTableName('site_htmlsnippets') . " chk where chk.snippet like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Snippet' as `type`,22 as action,snp.id,snp.name,'snp.snippet' from " . $modx->getFullTableName('site_snippets') . " snp where snp.snippet like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Plugin' as `type`,102 as action,plg.id,plg.name,'plg.plugincode' from " . $modx->getFullTableName('site_plugins') . " plg where plg.plugincode like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'Plugin (Configuration Parameter)' as `type`,102 as action, pcp.id, pcp.name,'pcp.properties' from " . $modx->getFullTableName('site_plugins') . " pcp where pcp.properties like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'META Keywords' as `type`,81 as action,kw.id,kw.keyword,'kw.keyword' from " . $modx->getFullTableName('site_keywords') . " kw where kw.keyword like concat('%','" . $modx->db->escape($find) . "','%')\n\n        union\n\n        select 'META Tags' as `type`,81 as action,mt.id,concat(mt.tag,' (',mt.name,')'),'mt.tagvalue' from " . $modx->getFullTableName('site_metatags') . " mt where mt.tagvalue like concat('%','" . $modx->db->escape($find) . "','%')\n\n    ");
        // Render grid
        $grid = new DataGrid('', $search, 9999);
        $grid->noRecordMsg = 'No matching records were found.';
        $grid->cssClass = "grid";
        $grid->columnHeaderClass = "gridHeader";
        $grid->itemClass = "gridItem";
        $grid->altItemClass = "gridAltItem";
        $grid->columns = " ,Type,Title";
        $grid->colTypes = "template:<formname='Ceditform' method='get' action=''><input type='hidden' value='[+id+]' name='id' /><input type='hidden' value='[+action+]' name='a' /><input type='submit' value='Edit' name='submit_btn' /></form>,template:[+type+],template:[+pagetitle+]";
        $grid->colWidths = "5%,20%,75%";
        $grid->fields = "template,type,pagetitle";
        $output .= $grid->render();
    }
    $output .= '</div></div> </div> </div> </div> ';
    /*
    end search
    */
}
$e->output($output);
return;