コード例 #1
0
ファイル: list.php プロジェクト: jincongho/clienthub
        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
 * @param string $value
 */
function getCompanyValue($value)
{
コード例 #2
0
ファイル: search.php プロジェクト: jincongho/clienthub
        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');