本文整理汇总了PHP中DataGrid::render方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::render方法的具体用法?PHP DataGrid::render怎么用?PHP DataGrid::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid::render方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDocGroups
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);
}
示例2: getHTMLGrid
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();
}
}
示例3: OR
}
$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>
示例4: getTVDisplayFormat
//.........这里部分代码省略.........
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;
}
示例5: count
$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+]' /> [+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();
}
}
示例6: function
}));
$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);*/
示例7: getHTMLGrid
/**
* 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();
}
}
示例8: deleteRecord
}
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;
}
示例9: DataGrid
$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&update=[+id+]&id=[+parent+]&pid=[+parent+]&to_shk=1" onclick="$.fn.colorbox.init();$.fn.colorbox($.extend(colorBoxOpt,{href:\'index.php?a=27&update=[+id+]&id=[+parent+]&pid=[+parent+]&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";
示例10: concat
});
</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;