本文整理汇总了PHP中Shineisp_Commons_Utilities::is_valid_date方法的典型用法代码示例。如果您正苦于以下问题:PHP Shineisp_Commons_Utilities::is_valid_date方法的具体用法?PHP Shineisp_Commons_Utilities::is_valid_date怎么用?PHP Shineisp_Commons_Utilities::is_valid_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shineisp_Commons_Utilities
的用法示例。
在下文中一共展示了Shineisp_Commons_Utilities::is_valid_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRecords
public function loadRecords(array $params)
{
$config = $this->getConfig();
$records = array();
$rows = array();
$iTotalRecords = 0;
$iFilteredTotal = 0;
$sOrder = "";
// Get the common information in order to read the records and the columns of the list
$columns = !empty($config['datagrid']['columns']) ? $config['datagrid']['columns'] : null;
$dq = !empty($config['datagrid']['dqrecordset']) && is_object($config['datagrid']['dqrecordset']) ? $config['datagrid']['dqrecordset'] : null;
$recordset = !empty($config['datagrid']['recordset']) ? $config['datagrid']['recordset'] : null;
// Check if the doctrine object is active
if (!empty($dq) && is_object($dq)) {
$iTotalRecords = $dq->count();
$iFilteredTotal = $dq->count();
$mainsearchvalue = !empty($params['sSearch']) ? $params['sSearch'] : null;
if (!empty($params['iColumns'])) {
// Filter the records per each column field
for ($i = 0; $i < intval($params['iColumns']); $i++) {
if ($params['bSearchable_' . $i] == "true") {
$colsearchvalue = !empty($params['sSearch_' . $i]) ? $params['sSearch_' . $i] : null;
if (!empty($columns[$i]['field'])) {
if ($mainsearchvalue) {
if (Shineisp_Commons_Utilities::is_valid_date($mainsearchvalue)) {
$mainsearchvalue = Shineisp_Commons_Utilities::formatDateIn($mainsearchvalue);
$dq->orWhere($columns[$i]['field'] . " = ?", $mainsearchvalue);
} else {
$dq->orWhere($columns[$i]['field'] . " like ?", "%{$mainsearchvalue}%");
}
} else {
if ($colsearchvalue) {
if (Shineisp_Commons_Utilities::is_valid_date($colsearchvalue)) {
$colsearchvalue = Shineisp_Commons_Utilities::formatDateIn($colsearchvalue);
$dq->andWhere($columns[$i]['field'] . " = ?", $colsearchvalue);
} else {
$dq->andWhere($columns[$i]['field'] . " like ?", "%{$colsearchvalue}%");
}
}
}
}
}
}
}
$query = $dq->getSqlQuery();
// Count the filtered records
$temprs = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
$iFilteredTotal = count($temprs);
// Paging of the records
if (isset($params['iDisplayStart']) && $params['iDisplayLength'] != '-1') {
$dq->offset($params['iDisplayStart']);
$dq->limit($params['iDisplayLength']);
}
// Sorting of the records
if (isset($params['iSortCol_0'])) {
for ($i = 0; $i < intval($params['iSortingCols']); $i++) {
$j = 0;
if ($params['bSortable_' . intval($params['iSortCol_' . $i])] == "true") {
foreach ($columns as $column) {
if (!empty($column['sortable']) && $column['sortable']) {
if ($j == $params['iSortCol_0'] - 1) {
$sOrder .= $column['field'] . " " . $params['sSortDir_' . $i] . ", ";
}
$j++;
}
}
}
}
$sOrder = substr_replace($sOrder, "", -2);
if (!empty($sOrder)) {
$dq->orderBy($sOrder);
}
}
#print_r($columns);
#Zend_Debug::dump($sOrder);
#print_r($dq->getDql());
#Zend_Debug::dump($rs);
#die;
// Execute the doctrine object to get the record array
$rs = $dq->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
// Complete the recordset with external values
$rs = self::injectData($rs);
} elseif (!empty($recordset) && is_array($recordset)) {
$iFilteredTotal = count($recordset);
$rs = $recordset;
}
$i = 0;
// For each record do ...
foreach ($rs as $record) {
$row = array();
$row['Row'] = "row_{$i}";
foreach ($columns as $column) {
if (!empty($column['alias'])) {
if (!empty($column['type'])) {
if ($column['type'] == "boolean") {
$badge = $record[$column['alias']] == 1 ? "badge-success" : "badge-important";
$label = $record[$column['alias']] == 1 ? $this->translator->translate("Yes") : $this->translator->translate("No");
$row[] = "<span class=\"badge {$badge}\">" . $label . "</span>";
} elseif ($column['type'] == "index") {
$badge = "badge-" . strtolower($record[$column['alias']]);
//.........这里部分代码省略.........