function _getItem_time($view,$display_id,$field){
$exposedContent = $view->get_exposed_input();
//假如暴露的过滤器有值,返回年月日时分秒的格式
if(!empty($exposedContent)){
if(!empty(date('Y-m-d H:i:s',strtotime($exposedContent[$field]['value']['date'])))){
return date('Y-m-d H:i:s',strtotime($exposedContent[$field]['value']['date']));
}
return '';
}
//假如暴露的过滤器没有值
else {
$item = $view->get_item($display_id, 'filter', $field);
if(!empty($item['value']['value'])){
$resultYMD = _toDMD($item['value']['value']);
}else if(!empty($item['value']['default_date'])){
$resultYMD = _toDMD($item['value']['value']);
}else if(!empty($item['default_date'])){
$resultYMD = _toDMD($item['value']['value']);
}else{
return '';
}
return date('Y-m-d H:i:s',$resultYMD);
}
}
//在视图执行sql语句前执行一些东西吧
function shipingzhongcustom_views_pre_execute(&$view)
{
// $viewArr = _objectToArray($view);
// var_dump(array_keys($viewArr));exit;
$filters = $view->display_handler->get_option('filters');
if($view->name=='allcontentview' && $view->current_display=='page_14')
{
//get_item 时间
$calcYMDHISStart = _getItem_time($view,'page_14','field_zong_time_value');
$calcYMDHISEnd = _getItem_time($view,'page_14','field_zong_time_value_1');
//搜出时间为 开始时间到结束时间的节点id 且正序排
$addSqlTimeStart = '';
!empty($calcYMDHISStart) && $addSqlTimeStart = " and ztime.field_zong_time_value>='".$calcYMDHISStart."'";
$addSqlTimeEnd = '';
!empty($calcYMDHISEnd) && $addSqlTimeEnd = " and ztime.field_zong_time_value>='".$calcYMDHISEnd."'";
$addlimitSql = 'limit 0,31';
//一页最大为31,因为一个月最大为31天
$page = $_GET['page'];
if(!empty($page)){
$addlimitSql = "limit ".(floatval($page)*31).",31";
}
$sql = "select n.nid from node n inner join field_zong_time_value ztime on n.nid=ztime.nid
where n.type='timezongtype'".$addSqlTimeStart.$addSqlTimeEnd." order by ztime.field_zong_time_value asc ".$addlimitSql;
$result = db_query($sql);
$rowNids = array();
while($rowObj = db_fetch_object($result)) {
$rowNids[] = $rowObj->nid;
}
foreach($rowNids as $key=>$value){
$node = node_load($value);
//判断客服表的字段是否是否为空
//本文件的约577行至579行 已进行 'presave'处理 .让在保存时 吴中客服组定金量=赵金梅定金量+王晶晶定金量
node_save($node);
}
}