/** * 营业数据 */ public function businessData($startTime = '', $endTime = '') { $s_time = date_to_int($startTime); $e_time = date_to_int($endTime); $list = CashModel::instance()->lists($this->user->getShopId(), '', $s_time, $e_time); $this->assign('startTime', $startTime); $this->assign('endTime', $endTime); $this->assign('list', $list); $this->display(); }
public function index() { $user_id = get_user_id(); $map = $this->_search(); if (method_exists($this, '_filter')) { $this->_filter($map); } $model = D("PayView"); if (empty($_POST['start_date']) & empty($_POST['end_date'])) { $start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d'); $end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d'); $this->_set_search("start_date", $start_date); $this->_set_search("end_date", $end_date); $map['create_time'] = array(array('gt', date_to_int($start_date)), array('lt', date_to_int($end_date))); } $this->assign('start_date', $start_date); $this->assign('end_date', $end_date); if (!empty($model)) { $this->_list($model, $map); } $this->display(); return; }
protected function _search($name = '') { $map = array(); //过滤非查询条件 $request = array_filter(array_keys(array_filter($_REQUEST)), "filter_search_field"); if (empty($name)) { $name = $this->getActionName(); } $model = D($name); $fields = get_model_fields($model); foreach ($request as $val) { if (!in_array(substr($val, 3), $fields)) { continue; } if (substr($val, 0, 3) == "be_") { if (isset($_REQUEST["en_" . substr($val, 3)])) { if (strpos($val, "time")) { $map[substr($val, 3)] = array(array('egt', date_to_int(trim($_REQUEST[$val]))), array('elt', date_to_int(trim($_REQUEST["en_" . substr($val, 3)])))); } if (strpos($val, "date")) { $map[substr($val, 3)] = array(array('egt', trim($_REQUEST[$val])), array('elt', trim($_REQUEST["en_" . substr($val, 3)]))); } } } if (substr($val, 0, 3) == "bt_") { $array_date = explode("|", str_replace(" - ", '|', $_REQUEST[$val])); if (strpos($val, "time")) { // dump("aaa"); $map[substr($val, 3)] = array(array('egt', date_to_int($array_date[0]), array('elt', date_to_int($array_date[1])))); // dump($map); } if (strpos($val, "")) { $map[substr($val, 3)] = array(array('egt', date_to_int($array_date[0]), array('elt', date_to_int($array_date[1])))); } if (strpos($val, "date")) { $map[substr($val, 3)] = array(array('egt', $array_date[0], array('elt', $array_date[1]))); } } if (substr($val, 0, 3) == "li_") { $map[substr($val, 3)] = array('like', '%' . trim($_REQUEST[$val]) . '%'); } if (substr($val, 0, 3) == "eq_") { $map[substr($val, 3)] = array('eq', trim($_REQUEST[$val])); } if (substr($val, 0, 3) == "gt_") { $map[substr($val, 3)] = array('egt', trim($_REQUEST[$val])); } if (substr($val, 0, 3) == "lt_") { $map[substr($val, 3)] = array('elt', trim($_REQUEST[$val])); } } return $map; }
$timedetail = date("Y-m-d H:i:s", time() - 21600); } elseif ($timedetail == '9') { $timedetail = date("Y-m-d H:i:s", time() - 32400); } elseif ($timedetail == '24') { $timedetail = date("Y-m-d H:i:s", time() - 86400); } elseif ($timedetail == '168') { $timedetail = date("Y-m-d H:i:s", time() - 604800); } elseif ($timedetail == '360') { $timedetail = date("Y-m-d H:i:s", time() - 1296000); } else { $timedetail = ''; } $fromdate = $_REQUEST['txtfrmdate']; $fromdate = date_to_int($fromdate) + $_REQUEST['from_time_hh'] * 3600 + $_REQUEST['from_time_mm'] * 60; $todate = $_REQUEST['txttodate']; $todate = date_to_int($todate) + $_REQUEST['to_time_hh'] * 3600 + $_REQUEST['to_time_mm'] * 60; ?> <title>Load / Performance Statistics : <?php echo $hostname; ?> </title> <table border=0 width=100% cellpadding="2" cellspacing="0" bgcolor=#E5E5E5 > <tr> <td width="90%" style="border-style: none; border-width: medium" align=left colspan=1> <font face=Arial size=2 color=#CC0000><b>HOST / FQDN MONITORING : <?php echo $hostname; ?> <?php echo $hostdesc;
function deliveryDate() { //lay ngay hien tai bang so $str = @date("d-m-Y-g:i a"); $currentDay = date_to_int($str); //@strtotime(date("d-m-Y-g:i a")); $totalDay = 1 * 24 * 60 * 60; //1 ngay: 1*24*60*60 $h = @date("g"); //lay gio $m = @date("a"); // lay buoi sang hay buoi chieu // am la buoi chieu tu 1->12 toi //pm la tu 1->12 chua if ($m == 'pm') { //nay du kien giao hang la--------------- $tongngay = $currentDay + $totalDay; $toado = explode("-", int_to_dateNoH($tongngay)); $jd = cal_to_jd(CAL_GREGORIAN, $toado[1], $toado[0], $toado[2]); $day = jddayofweek($jd, 0); switch ($day) { case 0: $thu = DSUNDAY; break; case 1: $thu = DMONDAY; break; case 2: $thu = DTUEDAY; break; case 3: $thu = DWDNESDAY; break; case 4: $thu = DTHUDAY; break; case 5: $thu = DFRIDAY; break; case 6: $thu = DSATUDAY; break; } $ngaygiaohang = $thu . ', ' . int_to_dateNoH($tongngay) . ': 3 ' . _dH . ' 30 ' . DMINUTES; } elseif ($m == 'am' and $h < 7) { $toado = explode("-", int_to_dateNoH($currentDay)); $jd = cal_to_jd(CAL_GREGORIAN, $toado[1], $toado[0], $toado[2]); $day = jddayofweek($jd, 0); switch ($day) { case 0: $thu = DSUNDAY; break; case 1: $thu = DMONDAY; break; case 2: $thu = DTUEDAY; break; case 3: $thu = DWDNESDAY; break; case 4: $thu = DTHUDAY; break; case 5: $thu = DFRIDAY; break; case 6: $thu = DSATUDAY; break; } $ngaygiaohang = $thu . ', ' . int_to_dateNoH($currentDay) . ': 3 ' . _dH . ' 30 ' . DMINUTES; } else { $toado = explode("-", int_to_dateNoH($tongngay)); $jd = cal_to_jd(CAL_GREGORIAN, $toado[1], $toado[0], $toado[2]); $day = jddayofweek($jd, 0); switch ($day) { case 0: $thu = DSUNDAY; break; case 1: $thu = DMONDAY; break; case 2: $thu = DTUEDAY; break; case 3: $thu = DWDNESDAY; break; case 4: $thu = DTHUDAY; break; case 5: $thu = DFRIDAY; break; case 6: $thu = DSATUDAY; break; } $ngaygiaohang = $thu . ', ' . int_to_date($tongngay) . ': 8 ' . _dH . ' 30 ' . DMINUTES; } $currentDay = date_to_int($str); return $ngaygiaohang; }
protected function _search($name = null) { $map = array(); //过滤非查询条件 $request = array_filter(array_keys(array_filter($_REQUEST)), "filter_search_field"); if (empty($name)) { $name = $this->getActionName(); } $model = D($name); $fields = get_model_fields($model); foreach ($request as $val) { $field = substr($val, 3); $prefix = substr($val, 0, 3); if (in_array($field, $fields)) { if ($prefix == "be_") { if (isset($_REQUEST["en_" . $field])) { if (strpos($field, "time")) { $map[$field] = array(array('egt', date_to_int(trim($_REQUEST[$val]))), array('elt', date_to_int(trim($_REQUEST["en_" . $field])) + 86400)); } if (strpos($field, "date")) { $map[$field] = array(array('egt', trim($_REQUEST[$val])), array('elt', trim($_REQUEST["en_" . substr($val, 3)]))); } } } if ($prefix == "li_") { $map[$field] = array('like', '%' . trim($_REQUEST[$val]) . '%'); } if ($prefix == "eq_") { $map[$field] = array('eq', trim($_REQUEST[$val])); } if ($prefix == "gt_") { $map[$field] = array('egt', trim($_REQUEST[$val])); } if ($prefix == "lt_") { $map[$field] = array('elt', trim($_REQUEST[$val])); } } } return $map; }
/** +---------------------------------------------------------- * 根据表单生成查询条件 * 进行列表过滤 +---------------------------------------------------------- * @access protected +---------------------------------------------------------- * @param string $name 数据对象名称 +---------------------------------------------------------- * @return HashMap +---------------------------------------------------------- * @throws ThinkExecption +---------------------------------------------------------- */ protected function _search($name = '', $view = false) { //生成查询条件 $map = array(); $request = array_filter(array_keys(array_filter($_REQUEST)), "filter_search_field"); if (empty($name)) { $name = $this->getActionName(); } $model = D($name); if ($view) { $fields = get_view_fields($model); } else { $fields = $model->getDbFields(); } foreach ($request as $val) { if (!in_array(substr($val, 3), $fields)) { continue; } if (substr($val, 0, 3) == "be_") { if (isset($_REQUEST["en_" . substr($val, 3)])) { if (strpos($val, "date")) { $map[substr($val, 3)] = array(array('egt', date_to_int(trim($_REQUEST[$val]))), array('elt', date_to_int(trim($_REQUEST["en_" . substr($val, 3)])))); } if (strpos($val, "time")) { $map[substr($val, 3)] = array(array('egt', trim($_REQUEST[$val])), array('elt', trim($_REQUEST["en_" . substr($val, 3)]))); } } } if (substr($val, 0, 3) == "li_") { $map[substr($val, 3)] = array('like', '%' . trim($_REQUEST[$val]) . '%'); } if (substr($val, 0, 3) == "eq_") { $map[substr($val, 3)] = array('eq', trim($_REQUEST[$val])); } if (substr($val, 0, 3) == "gt_") { $map[substr($val, 3)] = array('egt', trim($_REQUEST[$val])); } if (substr($val, 0, 3) == "lt_") { $map[substr($val, 3)] = array('elt', trim($_REQUEST[$val])); } } $this->_search = $map; return $map; }
} $currtimestamp = mktime(); $currentday = date('D', $currtimestamp); $task_summary = $_REQUEST["task_summary"]; $task_description = $_REQUEST["task_description"]; $task_date = $_REQUEST['schedule_date']; $task_hr = $_REQUEST['time_hh']; $task_min = $_REQUEST['time_mm']; $recurtype = $_REQUEST['recurtype']; if ($recurtype == "day") { $factor = 1; } elseif ($recurtype == "week") { $factor = 7; } $recurvalue = $_REQUEST['recur']; $scheduledate = date_to_int($task_date); $scheduledate = $scheduledate + $task_hr * 3600 + $task_min * 60; if ($recurtype == 'last day of month') { $lastdate = date('t', $currtimestamp); // current month no. of days $currmonth = date('m', $currtimestamp); $curryear = date('Y', $currtimestamp); $scheduledate = mktime($task_hr, $task_min, 00, $currmonth, $lastdate, $curryear); } $scheduleday = date('D', $scheduledate); if ($scheduleday == $currentday) { $difftimestamp = $scheduledate - $currtimestamp; if ($difftimestamp > 0 && $difftimestamp <= 3600) { $subject = $task_summary; $message = "SCHEDULED ACTIVITY : " . $task_description; ticket_post($smtp_email, $smtp_email, "29", "{$subject}", "{$message}", '4');
function my_info_pdf() { $where['is_check'] = array('eq', 1); $where['is_del'] = array('eq', 0); $base = M("UserInfoBase")->where($where)->order("create_time desc")->find(); $this->assign('base', $base); $start_time = $_REQUEST['be_create_time']; $end_time = $_REQUEST['en_create_time']; if (!empty($start_time) && !empty($end_time)) { $map['create_time'] = array(array('egt', date_to_int(trim($start_time))), array('elt', date_to_int(trim($end_time)))); $this->assign('start_time', $start_time); $this->assign('end_time', $end_time); } $map['user_id'] = array('eq', get_user_id()); $map['is_del'] = array('eq', 0); for ($i = 1; $i <= 14; $i++) { $sql = D("UserInfo\\Tab{$i}View")->buildSql(); $model = new Model(); $list = $model->table($sql . "a")->where($map)->select(); //dump($model->getLastSql(); $this->assign("tab" . $i, $list); } Vendor('Tcpdf.tcpdf'); //require_once('tcpdf_include.php'); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); //$pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('档案'); $pdf->SetSubject('档案'); $pdf->SetKeywords('档案'); // set default header data //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', PDF_HEADER_STRING); // set header and footer fonts //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('stsongstdlight', '', 10); // add a page $pdf->AddPage(); /* NOTE: * ********************************************************* * You can load external XHTML using : * * $html = file_get_contents('/path/to/your/file.html'); * * External CSS files will be automatically loaded. * Sometimes you need to fix the path of the external CSS. * ********************************************************* */ // define some HTML content with style //$html = $this->display(); $html = $this->fetch(); //dump($html); // output the HTML content $pdf->writeHTML($html, true, false, true, false, ''); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // add a page //$pdf->AddPage(); // reset pointer to the last page $pdf->lastPage(); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_061.pdf', 'I'); }
function qwp_validate_data(&$f, &$rules, &$filters = null, $just_unset_when_failed = false) { $msg_base = L('Invalid form data'); $valid_fields = array(); $predefined_rules = get_input_rules(); foreach ($rules as $field_name => &$rule) { $field_value = isset($f[$field_name]) ? $f[$field_name] : null; $valid_fields[$field_name] = true; if (isset($rule['_msg'])) { $msg =& $rule['_msg']; } else { $msg =& $msg_base; } if (isset($rule['required'])) { if ($field_value === null || $field_value === '') { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return $msg . '. ' . L('Current value is empty!'); } } else { if (isset($rule['optional'])) { if ($field_value === null || $field_value === '') { continue; } } } foreach ($rule as $key => $item) { if (substr($key, 0, 1) == '_') { if ($key == '_avoidSqlInj') { $f[$field_name] = mysql_real_escape_string($field_value); } continue; } if ($key == 'required' || $key == 'optional') { continue; } if ($key == 'date') { if (!date_to_int($field_value)) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'datetime') { if (!datetime_to_int($field_value)) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'digits') { if (!is_digits($field_value)) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'minlength') { $len = mb_strlen($field_value, 'utf8'); if ($len < $item) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'maxlength') { $len = mb_strlen($field_value, 'utf8'); if ($len > $item) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'rangelength') { $len = mb_strlen($field_value, 'utf8'); if ($len < $item[0] || $len > $item[1]) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'min') { if ($field_value < $item) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'max') { if ($field_value > $item) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'range' || $key == '[]') { if ($field_value < $item[0] || $field_value > $item[1]) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'equalTo' || $key == '=') { $equal_item = isset($f[$item[1]]) ? $f[$item[1]] : null; if ($field_value != $equal_item) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == 'in') { if (!in_array($field_value, $item)) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == '[)') { if ($field_value < $item[0] || $field_value >= $item[1]) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == '(]') { if ($field_value <= $item[0] || $field_value > $item[1]) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { if ($key == '()') { if ($field_value <= $item[0] || $field_value >= $item[1]) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } else { $fn_ret = is_valid_input($field_value, $key, $predefined_rules); if ($fn_ret !== -1 && !$fn_ret) { if ($just_unset_when_failed) { unset($f[$field_name]); continue; } return qwp_validate_get_error($msg, $field_value); } } } } } } } } } } } } } } } } } if ($filters) { qwp_filter_form_values($f, $filters); } remove_unwanted_data($f, $valid_fields); return true; }
$business_group_index = $_REQUEST["business_group_index"]; if ($error == 3) { echo "<font face=Arial size=2 color=#CC0000>Error {$error} : The first name was left blank.</font></b>"; } $office_index = $_REQUEST["office_index"]; $contact_phone_office = $_REQUEST["contact_phone_office"]; $contact_phone_residence = $_REQUEST["contact_phone_residence"]; $contact_phone_mobile = $_REQUEST["contact_phone_mobile"]; $contact_address = mysql_real_escape_string($_REQUEST["contact_address"]); $permanent_address = mysql_real_escape_string($_REQUEST["permanent_address"]); $personal_email = trim($_REQUEST["personal_email"]); $account_status = trim($_REQUEST["account_status"]); // Check for validity of the account expiry date $account_expiry = $_REQUEST["account_expiry"]; if (strlen($account_expiry) > 0) { $account_expiry = date_to_int($account_expiry); } $account_created_on = time(); $account_created_by = $username; if ($error > 0) { ?> <font face="Arial" size="2" color="#003399"><b><a href=javascript:history.back();>Click here to return to the previous screen to correct these errors</font></b></a> <?php } //If all the validations are successfully completed, insert the record into the table if ($error == 0) { if ($MD5_ENABLE == 1) { $enc_password = md5($password1); } else { $enc_password = $password1; }
protected function _search($model = null) { $map = array(); //过滤非查询条件 $request = array_filter(array_keys(array_filter($_REQUEST)), "filter_search_field"); if (empty($model)) { $model = D(CONTROLLER_NAME); } $fields = get_model_fields($model); foreach ($request as $val) { $field = substr($val, 3); $prefix = substr($val, 0, 3); if (in_array($field, $fields)) { if ($prefix == "be_") { if (isset($_REQUEST["en_" . $field])) { if (strpos($field, "time") != false) { $start_time = date_to_int(trim($_REQUEST[$val])); $end_time = date_to_int(trim($_REQUEST["en_" . $field])) + 86400; $map[$field] = array(array('egt', $start_time), array('elt', $end_time)); } if (strpos($field, "date") != false) { $start_date = trim($_REQUEST[$val]); $end_date = trim($_REQUEST["en_" . substr($val, 3)]); $map[$field] = array(array('egt', $start_date), array('elt', $end_date)); } } } if ($prefix == "li_") { $map[$field] = array('like', '%' . trim($_REQUEST[$val]) . '%'); } if ($prefix == "eq_") { $map[$field] = array('eq', trim($_REQUEST[$val])); } if ($prefix == "gt_") { $map[$field] = array('egt', trim($_REQUEST[$val])); } if ($prefix == "lt_") { $map[$field] = array('elt', trim($_REQUEST[$val])); } } } return $map; }