public function testGetTemplate() { // data array $array[] = array('name' => 'Davy Hellemans', 'email' => '*****@*****.**'); $array[] = array('name' => 'Tijs Verkoyen', 'email' => '*****@*****.**'); $array[] = array('name' => 'Dave Lens', 'email' => '*****@*****.**'); // create source $source = new SpoonDatagridSourceArray($array); // create datagrid $dg = new SpoonDatagrid($source); // fetch instance if ($dg->getTemplate() instanceof SpoonTemplate) { /* do nothing */ } else { throw new SpoonException('getTemplate should return an object of SpoonTemplate.'); } }
if ($pf[0] == 3) { $query = tableParser('profiles', 'searchLimit', $frm->getValues('form', 'submit', '_utf8')); if (count($query) > 0) { $tpl->assign('isResult', true); foreach ($query as $key => $value) { if (isset($value['photo'])) { $query[$key]['photo'] = '<img src="' . CM_URL . '/cm_api/images.php?id=' . $value['id'] . '&thumbnail=1" />'; } $query[$key]['action'] = '<a href="' . CM_URL . '/cm_admin/edit.php?id=' . $value['id'] . '" target="_blank">Edit</a><br /><a href="' . CM_URL . '/cm_admin/profile.php?id=' . $value['id'] . '" target="_blank">Print</a><br /><a href="" id="' . $value['id'] . '" class="delProfile">Delete</a>'; if (isset($query[$key]['attachment']) && strlen($query[$key]['attachment']) > 0) { $query[$key]['action'] .= '<br /><a href="' . CM_URL . '/cm_api/attachments.php?id=' . $value['id'] . '" target="_blank">Attach</a>'; } } //datagrid, generating results table $grid = new SpoonDataGridSourceArray($query); $datagrid = new SpoonDatagrid($grid); $datagrid->setColumnsHidden('id', 'attachment'); $datagrid->setCompileDirectory(COMPILE_PATH); $url = $_SERVER['QUERY_STRING'] ? cleanQuery($_SERVER['QUERY_STRING']) . 'offset=[offset]&order=[order]&sort=[sort]' : '?offset=[offset]&order=[order]&sort=[sort]'; $datagrid->setURL($url); $datagrid->setSortingColumns(array('file', 'name', 'ic', 'id'), 'id'); $datagrid->setPagingLimit(PAGING_LIMIT); $datagrid->setHeaderLabels(array('file' => '档案 File', 'case' => '案情 Case', 'photo' => '照片 Photo', 'name' => '姓名 Name', 'ic' => '身份证 IC', 'action' => '操作')); $tpl->assign('results', $datagrid->getContent()); } else { $tpl->assign('tooltip', 'No Relevant Results.'); $frm->parse($tpl); } } else { $frm->parse($tpl); }
$records = tableParser('profiles', 'getList'); if (count($records) > 0) { $tpl->assign('isResult', true); foreach ($records as $key => $value) { if (isset($value['photo'])) { $records[$key]['photo'] = '<img src="' . CM_URL . '/cm_api/images.php?id=' . $value['id'] . '&thumbnail=1" />'; } $records[$key]['action'] = '<a href="' . CM_URL . '/cm_admin/edit.php?id=' . $value['id'] . '" target="_blank">Edit</a><br /><a href="' . CM_URL . '/cm_admin/profile.php?id=' . $value['id'] . '" target="_blank">Print</a><br /><a href="" id="' . $value['id'] . '" class="delProfile">Delete</a>'; if (isset($value['attachment']) && strlen($value['attachment']) > 0) { $records[$key]['action'] .= '<br /><a href="' . CM_URL . '/cm_api/attachments.php?id=' . $value['id'] . '" target="_blank">Attach</a>'; } $records[$key]['company'] = getCompanyValue($value['company']); } //datagrid, generating results table $grid = new SpoonDataGridSourceArray($records); $datagrid = new SpoonDatagrid($grid); $datagrid->setCompileDirectory(COMPILE_PATH); $datagrid->setURL('?offset=[offset]&order=[order]&sort=[sort]'); $datagrid->setPagingLimit(PAGING_LIMIT); $datagrid->setColumnHidden('attachment'); $datagrid->setSortingColumns(array('file', 'name', 'ic', 'id'), 'id'); $datagrid->setHeaderLabels(array('file' => '档案<br />File', 'case' => '案情<br />Case', 'photo' => '照片Photo', 'name' => '姓名 <br />Name', 'ic' => '身份证 IC', 'company' => '公司 1<br />Company', 'action' => 'Action<br />操作')); $tpl->assign('results', $datagrid->getContent()); } else { $tpl->assign('tooltip', 'No Relevant Results.'); } $tpl->display(tpl_path('admin_list.tpl.php')); /** * Return first company details * * @return string
if ($value != NULL) { $query .= 'AND '; $query .= '`' . $key . '` LIKE \'%'; $query .= (string) $value; $query .= '%\' '; } } //get results $query = $mysql->getRecords($query); if (count($query) > 0) { $tpl->assign('isResult', true); foreach ($query as $key => $value) { if (isset($value['photo'])) { $query[$key]['photo'] = '<img src="' . BASE_URL . '/images.php?id=' . $value['id'] . '&thumbnail=1" />'; } $query[$key]['action'] = '<a href="' . BASE_URL . '/edit.php?id=' . $value['id'] . '" target="_blank">Edit</a><br /><a href="' . BASE_URL . '/profile.php?id=' . $value['id'] . '" target="_blank">Print</a><br /><a href="" id="' . $value['id'] . '" class="delProfile">Delete</a>'; } //datagrid, generating results table $grid = new SpoonDataGridSourceArray($query); $datagrid = new SpoonDatagrid($grid); $datagrid->setColumnHidden('id'); $datagrid->setHeaderLabels(array('file' => '档案 File', 'case' => '案情 Case', 'photo' => '照片 Photo', 'name' => '姓名 Name', 'ic' => '身份证 IC', 'company' => '公司 Company', 'action' => '操作')); $tpl->assign('results', $datagrid->getContent()); } else { $tpl->assign('tooltip', 'No Relevant Results.'); $frm->parse($tpl); } } else { $frm->parse($tpl); } $tpl->display(ROOT_PATH . '/' . TEMPLATE_PATH . '/search.tpl.php');