Пример #1
0
 public function getComment($article_id, $size)
 {
     $comment_model = D('message');
     $condition = !empty($article_id) ? array('article_id' => $article_id) : array();
     $count = $comment_model->where($condition)->count();
     $page = new \Think\Page($count, $size);
     $show = $page->show();
     $list = $comment_model->where($condition)->order('addtime desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     foreach ($list as $k => $v) {
         $list[$k]['formatTime'] = timeFormat($v['addtime']);
     }
     $data['list'] = $list;
     $data['page'] = $show;
     return $data;
 }
Пример #2
0
 public function json_user_list()
 {
     global $_M;
     $groupid = $_M['form']['groupid'];
     $keyword = $_M['form']['keyword'];
     $search = $groupid ? "and groupid = '{$groupid}'" : '';
     $search .= $keyword ? "and (username like '%{$keyword}%' || email like '%{$keyword}%' || tel like '%{$keyword}%')" : '';
     $table = load::sys_class('tabledata', 'new');
     $order = "login_time DESC,register_time DESC";
     $where = "lang='{$_M['lang']}' {$search}";
     $userlist = $table->getdata($_M['table']['user'], '*', $where, $order);
     $user_group = array();
     $group = DB::get_all("SELECT * FROM {$_M[table][user_group]} WHERE lang = '{$_M[form][lang]}'");
     foreach ($group as $key => $val) {
         $user_group[$val['id']] = $val['name'];
     }
     foreach ($userlist as $key => $val) {
         switch ($val['source']) {
             case 'weixin':
                 $val['source'] = '微信登录';
                 break;
             case 'weibo':
                 $val['source'] = '微博登录';
                 break;
             case 'qq':
                 $val['source'] = 'QQ登录';
                 break;
             default:
                 $val['source'] = '注册';
                 break;
         }
         if (!$val['login_time']) {
             $val['login_time'] = $val['register_time'];
         }
         $list = array();
         $list[] = "<input name=\"id\" type=\"checkbox\" value=\"{$val[id]}\">";
         $list[] = $val['username'];
         $list[] = $user_group[$val['groupid']];
         $list[] = timeFormat($val['register_time']);
         $list[] = timeFormat($val['login_time']);
         $list[] = $val['login_count'];
         $list[] = $val['valid'] ? '已激活' : '未激活';
         $list[] = $val['source'];
         $list[] = "<a href=\"{$_M[url][own_form]}a=doeditor&id={$val['id']}\" class=\"edit\">编辑</a><span class=\"line\">|</span><a href=\"{$_M[url][own_form]}a=dodellist&allid={$val['id']}\" class=\"delet\" data-confirm='{$_M[word][js7]}'>删除</a>";
         $rarray[] = $list;
     }
     $table->rdata($rarray);
 }
 public function fav_job_list($uid, $limit)
 {
     $sql = "select * from stj_job_collection job  where  uid={$uid}  and status=1 order by created_at desc limit {$limit}";
     $return_data = $this->table('stj_job_collection job')->query($sql);
     //echo "<pre>";var_dump($return_data);echo"</pre>";
     //得到岗位名称信息
     foreach ($return_data as $k => $v) {
         $return_data[$k]['id'] = $return_data[$k]['j_id'];
         $com_sql = "select com.cpname,com.id cpid from stj_company com where  com.id=" . $v['cpid'];
         //关联公司信息
         $recommended_sql = "select count(*) as num from stj_record where stj_record.j_id = {$v['j_id']}";
         //查找该职位已推荐人数
         ///echo $cas_sql;
         $return_data_com = $this->table('stj_company com')->query($com_sql);
         $recommendedArr = $this->table('stj_record')->query($recommended_sql);
         foreach ($return_data_com[0] as $k1 => $v1) {
             $return_data[$k][$k1] = $v1;
         }
         $return_data[$k]['recommendednum'] = $recommendedArr[0]['num'];
         $return_data[$k]['starttimedata'] = timeFormat($return_data[$k]['starttime'], $format = 'Y-m-d');
         $return_data[$k]['posttimedata'] = timeFormat($return_data[$k]['posttime'], $format = 'Y-m-d');
         $return_data[$k]['posttimedata'] = $return_data[$k]['checktime'] != 0 ? timeFormat($return_data[$k]['checktime'], $format = 'Y-m-d') : timeFormat($return_data[$k]['starttime'], $format = 'Y-m-d');
         //查找审核状态和是否被删除状态是否有变动
         $job_sql = "select * from stj_job  job where job.id=" . $return_data[$k]['id'];
         $return_data_job = $this->table('stj_job job')->query($job_sql);
         $audstart_sql = "select count(*) as num from stj_record where stj_record.j_id = {$v['j_id']} and audstart=6";
         //查找该职位已招到人数
         $audstartArr = $this->table('stj_record')->query($audstart_sql);
         //得到 薪资待遇 数据
         $arTreatmentdata = explode("-", str_replace("元", "", $return_data[$k]['treatmentdata']));
         if (count($arTreatmentdata) == 1) {
             $return_data[$k]['treatmentdata'] = "80K以上";
         } else {
             $return_data[$k]['treatmentdata'] = $arTreatmentdata[0] / 1000 . "K-" . $arTreatmentdata[1] / 1000 . "K";
         }
         //$return_data[$k]['treatmentdata'] = ($arTreatmentdata[0] / 1000) . "K-" . ($arTreatmentdata[1] / 1000) . "K";
         //判断是否已经过期或者已经招满或者变成审核失败或者已经删除
         if ($audstartArr[0]['num'] >= $return_data[$k]['employ'] || $return_data[$k]['endtime'] < time() || $return_data_job[0]['checkinfo'] == "false" || $return_data_job[0]['is_deleted'] == "1" || $return_data_job[0]['Tariff'] == null) {
             $return_data[$k]['deadline'] = 1;
         }
     }
     //var_dump($return_data);
     return $return_data;
 }
Пример #4
0
 public function view_usersearch()
 {
     $username = isset($_POST['username']) ? trim($_POST['username']) : '';
     if (empty($username)) {
         //没有指定用户名 报错
         $urldata = array('msg' => array('请输入要查找的用户名'), 'link' => 'index.php?mod=poweruser&act=list');
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     }
     $usermanager = new localUserManageModel();
     $seuserlist = $usermanager->searchUserByUserName($username);
     //搜索结果
     $location_ar = array('<a href="index.php?mod=poweruser&act=list" class="navhref">授权系统</a>', '>', '用户搜索', '>', $username);
     $this->tp_obj->set_var('module', '用户搜索列表--权限管理');
     $this->tp_obj->set_file('header', 'header.html');
     $this->tp_obj->set_file('footer', 'footer.html');
     $this->tp_obj->set_file('navbar', 'transmanagernav.html');
     $this->tp_obj->set_file('powerleftmenu', 'powerleftmenu.html');
     $this->tp_obj->set_file('powerpage', 'powerusersearchresult.html');
     $this->tp_obj->set_block('navbar', 'navlist', 'locationlist');
     //导航
     foreach ($location_ar as $lval) {
         $this->tp_obj->set_var('location', $lval);
         $this->tp_obj->parse('locationlist', 'navlist', TRUE);
     }
     $this->tp_obj->set_var('keywords', $username);
     $this->tp_obj->set_block('powerpage', 'userlist', 'user_l');
     foreach ($seuserlist as $value) {
         $this->tp_obj->set_var('uid', $value['uid']);
         $this->tp_obj->set_var('username', $value['username']);
         $this->tp_obj->set_var('powertype', $usermanager->powerTypeMapping($value['powertype']));
         $this->tp_obj->set_var('updatetime', timeFormat($value['updatetime']));
         $this->tp_obj->parse('user_l', 'userlist', TRUE);
     }
     $this->tp_obj->set_var('username', $_SESSION['userName']);
     $this->tp_obj->parse('header', 'header');
     $this->tp_obj->parse('footer', 'footer');
     $this->tp_obj->parse('powerleftmenu', 'powerleftmenu');
     $this->tp_obj->parse('powerpage', 'powerpage');
     $this->tp_obj->p('powerpage');
 }
Пример #5
0
	<div class="col-lg-6">
		<div class="panel panel-default">
			<div class="panel-heading">Top Records</div>
			<div class="panel-body">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover" id="dataTables-example">
						<thead>
							<tr>
								<th>Rank</th>
								<th>Map</th>
								<th>Time</th>
								<th>Style</th>
								<th>Track</th>
							</tr>
						</thead>
						<tbody>
						<?php 
$sql = "SELECT `rank`, `map`, `time`, `style`, `track` FROM `round` WHERE (`auth` = " . $ex . $steamid . $ex . " OR `auth` = " . $ex . $steamfix . $ex . ") ORDER BY `rank`, `time`, `map` LIMIT 10;";
$players = $link->query($sql);
while ($array = mysqli_fetch_array($players)) {
    echo "<tr class=\"odd gradeX\">\n\t\t\t\t\t\t   <td>" . $array[0] . "</td>\n\t\t\t\t\t\t   <td>" . $array[1] . "</td>\n\t\t\t\t\t\t   <td>" . timeFormat($array[2]) . "</td>\n\t\t\t\t\t\t   <td>" . getKeyByArrayValue($array[3], $style_list) . "</td>\n\t\t\t\t\t\t   <td>" . getKeyByArrayValue($array[4], $track_list) . "</td>\n\t\t\t\t\t\t   </tr>";
}
?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
Пример #6
0
 function getRevertById($nMsgId)
 {
     $aRs = $this->db->select('SELECT subject,message,date_line FROM sdb_message WHERE for_id=' . $nMsgId);
     if ($aRs) {
         foreach ($aRs as $key => $val) {
             $aRs[$key]['date_line'] = timeFormat($val['date_line']);
         }
     }
     return $aRs;
 }
Пример #7
0
    <div class="box280">
      <div class="tit"><strong>当季旅游推荐</strong></div>
      <div class="zhuti">
        <a href="" title="亲子游专题" target="_blank"><img src="http://s.cncnimg.cn/images/a/2014/250x195_qinziyou_140528.png" alt="亲子游专题"></a>
      </div>
    </div>

    <div class="box280">
      <div class="tit">
        <strong>最新预订</strong>
      </div>
      <div class="txt_order">
        <?php if(!empty($output['orderList'])){foreach($output['orderList'] as $v){?>
        <dl>
          <i class="i1"></i>
          <dt><span class="time"><?php echo timeFormat($v['add_time']);?></span><em><?php echo $v['buyer_name']?></em> <span>预定一张订单</span></dt>
          <dd clss="title"><a href="<?php echo $v['url']?>" target="_blank"><?php echo $v['store_name']?></a></dd>
        </dl>
        <?php }}?>
      </div>
    </div>


    
  </div>
  <div class="clearfix"></div>

</div>
<!-- [//主体部分] -->
<!-- [//列表页] -->
Пример #8
0
    <div class="post-container" alt="<?php 
echo $user['uname'];
?>
">
        <div class="post-wall">
          <?php 
date_default_timezone_set('America/New_York');
$enddate = date('Y-m-d H:i:s', time());
if (!$posts) {
    echo '<div style="text-align:center; margin-top: 30px;color: #A32824"><h1>The user has no post yet.</h1></div>';
} else {
    foreach ($posts as $post) {
        if ($post['visible'] == 0) {
            $startdate = $post['addtime'];
            $time_pass = timeFormat($enddate, $startdate);
            if ($time_pass['year'] > 0) {
                $show_time_pass = array('number' => $time_pass['year'], 'unit' => 'year');
            } else {
                if ($time_pass['month'] > 0) {
                    $show_time_pass = array('number' => $time_pass['month'], 'unit' => 'month');
                } else {
                    if ($time_pass['day'] > 0) {
                        $show_time_pass = array('number' => $time_pass['day'], 'unit' => 'day');
                    } else {
                        if ($time_pass['hour'] > 0) {
                            $show_time_pass = array('number' => $time_pass['hour'], 'unit' => 'hour');
                        } else {
                            if ($time_pass['minute'] > 0) {
                                $show_time_pass = array('number' => $time_pass['minute'], 'unit' => 'minute');
                            } else {
Пример #9
0
Файл: at.php Проект: virola/umsg
<?php

include './common/db.php';
$user = $common['user'];
$sql = 'select toid, username, authorid, max(dateline) as timeline, count(*) as msgcount from message,user where delstatus=0 and message.toid=1 and message.authorid=user.userid group by authorid order by dateline desc  limit 0,10';
$sqljoin = 'select toid, authorid, content, max(dateline) as timeline, count(*) as msgcount, username from message,user where delstatus=0 and message.toid=' . $user['userid'] . ' and authorid=userid group by authorid order by timeline desc;';
$result = mysql_query($sqljoin);
$msg_arr = array();
if ($result) {
    while ($row = mysql_fetch_array($result)) {
        $msg_arr[] = array('userid' => $row['authorid'], 'username' => $row['username'], 'content' => getLatestMsg($row['authorid'], $user['userid'], $con), 'dateline' => timeFormat($row['timeline']), 'realtime' => $row['timeline'], 'avator' => getAvator(), 'newcount' => mt_rand(0, 10));
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <?php 
include './common/meta.php';
?>
    <title>纸条</title>
</head>
<body>

<?php 
$mod = 'at';
$doc_title = '@提到我的';
include './common/header.php';
?>
Пример #10
0
 function parent_login_log($parent_id)
 {
     $parent_login_logs = $this->parents_model->order_by('date_time', 'DESC')->getWhere(array('parent_id' => $parent_id), IMS_DB_PREFIX . 'parent_login_log');
     if (!$parent_login_logs) {
         echo json_encode(array('status' => 'false'));
     } else {
         $new_parent_login_logs = array();
         foreach ($parent_login_logs as $k => $parent_login_log) {
             $new_parent_login_logs[$k] = $parent_login_log;
             $new_parent_login_logs[$k]->date = dateFormat($parent_login_log->date_time);
             $new_parent_login_logs[$k]->time = timeFormat($parent_login_log->date_time);
         }
         echo json_encode(array('status' => 'true', 'parent_login_logs' => $new_parent_login_logs));
     }
 }
Пример #11
0
    <div class="uk-width-1-6"><?php 
    echo ucwords($val);
    ?>
</div>
    <div class="uk-width-1-6">
      <?php 
    echo CHtml::textField("stores_open_starts[{$key}]", array_key_exists($key, (array) $stores_open_starts) ? timeFormat($stores_open_starts[$key], true) : "", array('placeholder' => Yii::t("default", "Start"), 'class' => "timepick"));
    ?>
    </div>
    <div class="uk-width-1-6" style="width:5%;"><?php 
    echo Yii::t("default", "To");
    ?>
</div>
    <div class="uk-width-1-6">
      <?php 
    echo CHtml::textField("stores_open_ends[{$key}]", array_key_exists($key, (array) $stores_open_ends) ? timeFormat($stores_open_ends[$key], true) : "", array('placeholder' => Yii::t("default", "End"), 'class' => "timepick"));
    ?>
    </div>
    <div class="uk-width-1-6">
      <?php 
    echo CHtml::textField("stores_open_custom_text[{$key}]", array_key_exists($key, (array) $stores_open_custom_text) ? $stores_open_custom_text[$key] : "", array('placeholder' => Yii::t("default", "Custom text")));
    ?>
     </div>
   </div>    
  </li>
  <?php 
}
?>
  </ul>
</div>
Пример #12
0
    } else {
        $query = $link->query("SELECT COUNT(*) FROM `round` WHERE `map` LIKE '" . $map . "' AND `track` = '" . $track . "' AND `style` = '" . $style . "'");
    }
}
$array2 = mysqli_fetch_array($query);
$totalplayers = $array2[0];
if ($style == -1) {
    if ($track == -1) {
        $sql = "SELECT `rank`, `name`, `auth`, `time`, `style`, `track`, `date` FROM `round` WHERE `map` LIKE '" . $map . "' ORDER BY `time` ASC LIMIT 25";
    } else {
        $sql = "SELECT `rank`, `name`, `auth`, `time`, `style`, `track`, `date` FROM `round` WHERE `map` LIKE '" . $map . "' AND `track` = '" . $track . "' ORDER BY `time` ASC LIMIT 25";
    }
} else {
    if ($track == -1) {
        $sql = "SELECT `rank`, `name`, `auth`, `time`, `style`, `track`, `date` FROM `round` WHERE `map` LIKE '" . $map . "' AND `style` = '" . $style . "' ORDER BY `time` ASC LIMIT 25";
    } else {
        $sql = "SELECT `rank`, `name`, `auth`, `time`, `style`, `track`, `date` FROM `round` WHERE `map` LIKE '" . $map . "' AND `track` = '" . $track . "' AND `style` = '" . $style . "' ORDER BY `time` ASC LIMIT 25";
    }
}
$players = $link->query($sql);
while ($array = mysqli_fetch_array($players)) {
    echo "<tr class=\"odd gradeX\">\n\t\t\t\t\t\t\t\t<td>" . $array[0] . "</td>\n\t\t\t\t\t\t\t\t<td><a href='index.php?site=player&auth=" . $array[2] . "'>" . $array[1] . "</a></td>\n\t\t\t\t\t\t\t\t<td>" . timeFormat($array[3]) . "</td>\n\t\t\t\t\t\t\t\t<td>" . getKeyByArrayValue($array[4], $style_list) . "</td>\n\t\t\t\t\t\t\t\t<td>" . getKeyByArrayValue($array[5], $track_list) . "</td>\n\t\t\t\t\t\t\t\t<td>" . $array[6] . "</td>\n\t\t\t\t\t\t\t\t</tr>";
}
?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
Пример #13
0
function consoleLog($content)
{
    echo timeFormat(time()) . ' ' . strval($content) . "\n";
}
Пример #14
0
 public function getOperationalHours($merchant_id = '')
 {
     $stores_open_day = Yii::app()->functions->getOption("stores_open_day", $merchant_id);
     $stores_open_starts = Yii::app()->functions->getOption("stores_open_starts", $merchant_id);
     $stores_open_ends = Yii::app()->functions->getOption("stores_open_ends", $merchant_id);
     $stores_open_custom_text = Yii::app()->functions->getOption("stores_open_custom_text", $merchant_id);
     $stores_open_day = !empty($stores_open_day) ? (array) json_decode($stores_open_day) : false;
     $stores_open_starts = !empty($stores_open_starts) ? (array) json_decode($stores_open_starts) : false;
     $stores_open_ends = !empty($stores_open_ends) ? (array) json_decode($stores_open_ends) : false;
     $stores_open_custom_text = !empty($stores_open_custom_text) ? (array) json_decode($stores_open_custom_text) : false;
     $tip = '';
     $open_starts = '';
     $open_ends = '';
     $open_text = '';
     $tip .= "<ul class=\"hr_op rounded2\"><i class=\"fa fa-caret-up\"></i>";
     if (is_array($stores_open_day) && count($stores_open_day) >= 1) {
         foreach ($stores_open_day as $val_open) {
             if (array_key_exists($val_open, (array) $stores_open_starts)) {
                 $open_starts = timeFormat($stores_open_starts[$val_open], true);
             }
             if (array_key_exists($val_open, (array) $stores_open_ends)) {
                 $open_ends = timeFormat($stores_open_ends[$val_open], true);
             }
             if (array_key_exists($val_open, (array) $stores_open_custom_text)) {
                 $open_text = $stores_open_custom_text[$val_open];
             }
             $tip .= '<li><span>' . ucwords(Yii::t("default", $val_open)) . '</span><value>' . $open_starts . " - " . $open_ends . "&nbsp;&nbsp;&nbsp;" . ucfirst($open_text) . '</value></li>';
             $open_starts = '';
             $open_ends = '';
             $open_text = '';
         }
     } else {
         $tip .= "<li>" . Yii::t("default", "Not available.") . "</li>";
     }
     $tip .= "<div class=\"clear\"></div>";
     $tip .= "</ul>";
     $tips = "<a class=\"opening-hours-wrap\" href=\"javascript:;\">" . Yii::t("default", "Hours of Operation") . "{$tip}</a>";
     return $tips;
 }
Пример #15
0
 public function searchArea()
 {
     $resto_cuisine = '';
     $rating = '';
     $minimum = '';
     $pay_by = '';
     $minus_has_delivery_rates = 0;
     $cuisine_list = Yii::app()->functions->Cuisine(true);
     $country_list = Yii::app()->functions->CountryList();
     $this->data['s'] = isset($this->data['s']) ? $this->data['s'] : "";
     $search_str = explode(",", $this->data['s']);
     if (is_array($search_str) && count($search_str) >= 2) {
         $city = isset($search_str[1]) ? trim($search_str[1]) : '';
         $state = isset($search_str[2]) ? trim($search_str[2]) : '';
     } else {
         $city = trim($this->data['s']);
         $state = trim($this->data['s']);
     }
     $from_address = $this->data['s'];
     if (empty($from_address)) {
         $from_address = isset($this->data['st']) ? $this->data['st'] : '';
         if (!empty($this->data['st'])) {
             $_SESSION['kr_search_address'] = $this->data['st'];
         }
     }
     if ($res = Yii::app()->functions->searchByArea($city, $state)) {
         if (is_array($res) && count($res) >= 1) {
             $total = Yii::app()->functions->search_result_total;
             $feed_datas['sEcho'] = $this->data['sEcho'];
             $feed_datas['iTotalRecords'] = $total;
             $feed_datas['iTotalDisplayRecords'] = $total;
             /*dump($feed_datas);
               die();*/
             foreach ($res as $val) {
                 $merchant_address = $val['street'] . " " . $val['city'] . " " . $val['post_code'];
                 $miles = 0;
                 $kms = 0;
                 $ft = false;
                 $new_distance_raw = 0;
                 if ($distance = getDistance($from_address, $merchant_address, $val['country_code'], false)) {
                     $miles = $distance->rows[0]->elements[0]->distance->text;
                     //dump($miles);
                     if (preg_match("/ft/i", $miles)) {
                         $ft = true;
                         $miles_raw = $miles;
                         $new_distance_raw = str_replace("ft", '', $miles);
                         $new_distance_raw = ft2kms(trim($new_distance_raw));
                     } else {
                         $miles_raw = str_replace(array(" ", "mi"), "", $miles);
                         $kms = miles2kms(unPrettyPrice($miles_raw));
                         $new_distance_raw = $kms;
                         $kms = standardPrettyFormat($kms);
                     }
                 }
                 /*get merchant distance */
                 $mt_delivery_miles = Yii::app()->functions->getOption("merchant_delivery_miles", $val['merchant_id']);
                 $merchant_distance_type = Yii::app()->functions->getOption("merchant_distance_type", $val['merchant_id']);
                 /*dump($mt_delivery_miles);
                 		dump($miles_raw);*/
                 $resto_cuisine = '';
                 $cuisine = !empty($val['cuisine']) ? (array) json_decode($val['cuisine']) : false;
                 if ($cuisine != false) {
                     foreach ($cuisine as $valc) {
                         if (array_key_exists($valc, (array) $cuisine_list)) {
                             $resto_cuisine .= $cuisine_list[$valc] . ", ";
                         }
                     }
                     $resto_cuisine = !empty($resto_cuisine) ? substr($resto_cuisine, 0, -2) : '';
                 }
                 $resto_info = "<h5><a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">" . $val['restaurant_name'] . "</a></h5>";
                 //$resto_cuisine="<span class=\"cuisine-list\">".$resto_cuisine."</span>";
                 $resto_cuisine = wordwrap($resto_cuisine, 50, "<br />\n");
                 $resto_info .= "<p class=\"uk-text-muted\">" . $val['street'] . " " . $val['city'] . " " . $val['post_code'] . "</p>";
                 if (array_key_exists($val['country_code'], (array) $country_list)) {
                     $resto_info .= "<p class=\"uk-text-bold\">" . $country_list[$val['country_code']] . "</p>";
                 }
                 $resto_info .= "<p class=\"uk-text-bold\">" . Yii::t('default', "Cuisine") . " - " . $resto_cuisine . "</p>";
                 $delivery_est = Yii::app()->functions->getOption("merchant_delivery_estimation", $val['merchant_id']);
                 $distancesya = $miles_raw;
                 $unit_distance = $merchant_distance_type;
                 if (!empty($from_address)) {
                     if ($ft == TRUE) {
                         $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} </p>";
                         if ($merchant_distance_type == "km") {
                             $distance_type = Yii::t("default", "km");
                         } else {
                             $distance_type = Yii::t("default", "miles");
                         }
                     } else {
                         if ($merchant_distance_type == "km") {
                             $distance_type = Yii::t("default", "km");
                             $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$kms} " . Yii::t("default", "km") . "</p>";
                             $distancesya = $kms;
                         } else {
                             $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} " . Yii::t("default", "miles") . "</p>";
                             $distance_type = Yii::t("default", "miles");
                         }
                     }
                 }
                 $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Est") . ": </span> " . $delivery_est . "</p>";
                 if (is_numeric($mt_delivery_miles)) {
                     $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Distance") . ": </span> " . $mt_delivery_miles . " " . $distance_type . "</p>";
                 }
                 $shipping_enabled = Yii::app()->functions->getOption("shipping_enabled", $val['merchant_id']);
                 //delivery rates table
                 $delivery_fee = $val['delivery_charges'];
                 if ($shipping_enabled == 2) {
                     $FunctionsK = new FunctionsK();
                     //$distancesya=round($distancesya);
                     //dump($distancesya);
                     $delivery_fee = $FunctionsK->getDeliveryChargesByDistance($val['merchant_id'], $distancesya, $unit_distance, $delivery_fee);
                     if ($delivery_fee >= 0.01) {
                         if (isset($_GET['filter_promo'])) {
                             if (preg_match("/free-delivery/i", $_GET['filter_promo'])) {
                                 $minus_has_delivery_rates++;
                                 continue;
                             }
                         }
                     }
                 }
                 if (is_numeric($delivery_fee) && $delivery_fee >= 1) {
                     $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . displayPrice(getCurrencyCode(), prettyFormat($delivery_fee)) . "</p>";
                 } else {
                     $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . "<span class=\"uk-text-success\">" . Yii::t("default", "Free Delivery") . "</span>" . "</p>";
                 }
                 $image = '';
                 $merchant_photo = Yii::app()->functions->getOption("merchant_photo", $val['merchant_id']);
                 if (!empty($merchant_photo)) {
                     $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">";
                     $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/upload/" . $merchant_photo . "\" alt=\"\" title=\"\">";
                     $image .= "</a>";
                 }
                 if (empty($image)) {
                     $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">";
                     $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/assets/images/thumbnail-medium.png\" alt=\"\" title=\"\">";
                     $image .= "</a>";
                 }
                 $ratings = Yii::app()->functions->getRatings($val['merchant_id']);
                 $rating_meanings = '';
                 if ($ratings['ratings'] >= 1) {
                     $rating_meaning = Yii::app()->functions->getRatingsMeaning($ratings['ratings']);
                     $rating_meanings = ucwords($rating_meaning['meaning']);
                 }
                 $rating = "<div class=\"rate-wrap\">\r\n\t    \t\t\t\t<h6 class=\"rounded2\" data-uk-tooltip=\"{pos:'bottom-left'}\" title=\"{$rating_meanings}\" >" . number_format($ratings['ratings'], 1) . "</h6>\r\n\t    \t\t\t\t<span>" . $ratings['votes'] . " " . Yii::t("default", "Votes") . "</span>\r\n\t    \t\t\t\t</div>";
                 $stores_open_day = Yii::app()->functions->getOption("stores_open_day", $val['merchant_id']);
                 $stores_open_starts = Yii::app()->functions->getOption("stores_open_starts", $val['merchant_id']);
                 $stores_open_ends = Yii::app()->functions->getOption("stores_open_ends", $val['merchant_id']);
                 $stores_open_custom_text = Yii::app()->functions->getOption("stores_open_custom_text", $val['merchant_id']);
                 $stores_open_day = !empty($stores_open_day) ? (array) json_decode($stores_open_day) : false;
                 $stores_open_starts = !empty($stores_open_starts) ? (array) json_decode($stores_open_starts) : false;
                 $stores_open_ends = !empty($stores_open_ends) ? (array) json_decode($stores_open_ends) : false;
                 $stores_open_custom_text = !empty($stores_open_custom_text) ? (array) json_decode($stores_open_custom_text) : false;
                 $tip = '';
                 $open_starts = '';
                 $open_ends = '';
                 $open_text = '';
                 $tip .= "<ul class=\"hr_op rounded2\"><i class=\"fa fa-caret-up\"></i>";
                 if (is_array($stores_open_day) && count($stores_open_day) >= 1) {
                     foreach ($stores_open_day as $val_open) {
                         if (array_key_exists($val_open, (array) $stores_open_starts)) {
                             $open_starts = timeFormat($stores_open_starts[$val_open], true);
                         }
                         if (array_key_exists($val_open, (array) $stores_open_ends)) {
                             $open_ends = timeFormat($stores_open_ends[$val_open], true);
                         }
                         if (array_key_exists($val_open, (array) $stores_open_custom_text)) {
                             $open_text = $stores_open_custom_text[$val_open];
                         }
                         $tip .= '<li><span>' . ucwords(Yii::t("default", $val_open)) . '</span><value>' . $open_starts . " - " . $open_ends . "&nbsp;&nbsp;&nbsp;" . ucfirst($open_text) . '</value></li>';
                         $open_starts = '';
                         $open_ends = '';
                         $open_text = '';
                     }
                 } else {
                     $tip .= '<li>' . Yii::t("default", "Not available.") . '</li>';
                 }
                 $tip .= "<div class=\"clear\"></div>";
                 $tip .= "</ul>";
                 $tips = "<a class=\"opening-hours-wrap\" href=\"javascript:;\">" . Yii::t("default", "Hours of Operation") . "{$tip}</a>";
                 $resto_info .= $tips;
                 $resto_info .= "<div class=\"spacer\"></div>";
                 $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">";
                 $resto_info .= Yii::t("default", "Order Now");
                 $resto_info .= "</a></div>";
                 $resto_info .= "<div class=\"spacer\"></div>";
                 $table_book = Yii::app()->functions->getOption("merchant_table_booking", $val['merchant_id']);
                 if ($table_book == "") {
                     $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "/?tab=booking" . "\">";
                     $resto_info .= Yii::t("default", "Book a Table");
                     $resto_info .= "</a></div>";
                 }
                 $is_sponsored = '';
                 if ($val['is_sponsored'] == 2) {
                     $is_sponsored = "<br/><div class=\"uk-badge uk-badge-warning\">" . Yii::t("default", "sponsored") . "</div>";
                 }
                 $is_merchant_open = Yii::app()->functions->isMerchantOpen($val['merchant_id']);
                 $merchant_preorder = Yii::app()->functions->getOption("merchant_preorder", $val['merchant_id']);
                 $now = date('Y-m-d');
                 $is_holiday = false;
                 if ($m_holiday = Yii::app()->functions->getMerchantHoliday($val['merchant_id'])) {
                     if (in_array($now, (array) $m_holiday)) {
                         $is_merchant_open = false;
                     }
                 }
                 $tag_open = '';
                 if ($is_merchant_open == TRUE) {
                     $tag_open = '<div class="uk-badge uk-badge-success">' . t("Open") . '</div>';
                 } else {
                     if ($merchant_preorder) {
                         $tag_open = '<div class="uk-badge uk-badge-warning">' . t("Pre-Order") . '</div>';
                     } else {
                         $tag_open = '<div class="uk-badge uk-badge-danger">' . t("Closed") . '</div>';
                     }
                 }
                 $is_sponsored .= $tag_open;
                 $offers = Widgets::offers($val['merchant_id'], 2);
                 $is_sponsored .= $offers;
                 $merchant_latitude = Yii::app()->functions->getOption("merchant_latitude", $val['merchant_id']);
                 $merchant_longtitude = Yii::app()->functions->getOption("merchant_longtitude", $val['merchant_id']);
                 $merchant_latitude = !empty($merchant_latitude) ? $merchant_latitude : '0';
                 $merchant_longtitude = !empty($merchant_longtitude) ? $merchant_longtitude : '0';
                 $feed_data[] = array($image, $resto_info, $rating, !empty($val['minimum_order']) ? displayPrice(getCurrencyCode(), prettyFormat($val['minimum_order'])) . "<br/>" . $is_sponsored : "{$is_sponsored}", $miles_raw, $merchant_latitude, $merchant_longtitude, addslashes($val['restaurant_name']), $merchant_address, $val['restaurant_slug'], $image, $new_distance_raw);
             }
             $this->data['sort_filter'] = isset($this->data['sort_filter']) ? $this->data['sort_filter'] : '';
             //dump($feed_data);
             if ($this->data['sort_filter'] == "distance") {
                 Yii::app()->functions->arraySortByColumn($feed_data, 11);
                 $feed_datas['aaData'] = $feed_data;
             } else {
                 /** sort by distance */
                 if (Yii::app()->functions->getOptionAdmin('search_result_bydistance') == 2) {
                     Yii::app()->functions->arraySortByColumn($feed_data, 11);
                     $feed_datas['aaData'] = $feed_data;
                 } else {
                     $feed_datas['aaData'] = $feed_data;
                 }
             }
             //dump("minus_has_delivery_rates->".$minus_has_delivery_rates);
             if ($minus_has_delivery_rates >= 1) {
                 $feed_datas['iTotalRecords'] = $feed_datas['iTotalRecords'] - $minus_has_delivery_rates;
                 $feed_datas['iTotalDisplayRecords'] = $feed_datas['iTotalDisplayRecords'] - $minus_has_delivery_rates;
                 if ($feed_datas['iTotalRecords'] <= 0) {
                     $this->otableNodata();
                 }
             }
             $this->otableOutput($feed_datas);
         }
     }
     $this->otableNodata();
 }
Пример #16
0
 public function save_leave_request($request_id = NULL)
 {
     if ($this->input->post()) {
         if ($this->_validate_leave_request()) {
             $data = array('leave_type_id' => $this->input->post('leave_type_id'), 'user_id' => $this->input->post('staff_id'), 'status' => '0', 'start_date' => mysqlDateFormat($this->input->post('start_date')), 'end_date' => mysqlDateFormat($this->input->post('end_date')), 'start_time' => $this->input->post('start_time'), 'end_time' => $this->input->post('end_time'), 'description' => $this->input->post('remarks'), 'is_deleted' => '0', 'applied_date' => date('Y-m-d'));
             $this->load->model('work_profile_model');
             $work_profile_id = $this->work_profile_model->select('id')->getOneWhere(array('user_id' => $this->input->post('staff_id')), IMS_DB_PREFIX . 'work_profile');
             if (empty($work_profile_id)) {
                 die(json_encode(array('status' => 'error', 'msg' => 'Fail to take leave! Your work profile has not been set yet.')));
             } else {
                 $work_profile_id = $work_profile_id->id;
             }
             $work_profile = $this->work_profile_model->get_work_profile_by_id($work_profile_id);
             $time = calculate_leave_hours($this->input->post('start_date'), $this->input->post('start_time'), $this->input->post('end_date'), $this->input->post('end_time'), $work_profile);
             $data['hours'] = $time;
             if ($request_id != NULL) {
                 $result = $this->leave_model->updateRow($request_id, $data, 'id', IMS_DB_PREFIX . 'leave_requests');
                 $data['request_id'] = $request_id;
                 $result ? die(json_encode(array('status' => 'success', 'msg' => 'Leave Request Edited Successfully.', 'data' => $data))) : die(json_encode(array('status' => 'error', 'msg' => 'Cannot Edit Leave Application. Please try again later.')));
             } else {
                 $request_id = $this->leave_model->insertRow($data, IMS_DB_PREFIX . 'leave_requests');
                 $data['request_id'] = $request_id;
                 $selected_year = $this->input->post('selected_year');
                 if ($this->input->post('leave_type_id') == 1) {
                     $data['off_claimed'] = $this->leave_model->getUserBalance($this->input->post('staff_id'), 1, $selected_year);
                 }
                 $total_leave_claimed = $this->leave_model->getTotalLeaveTaken($data['user_id'], $selected_year, 1, 'not');
                 $total_leave_off_claimed = $this->leave_model->getTotalLeaveTaken($data['user_id'], $selected_year, 1);
                 $total_leave_accumulated = $this->leave_model->getTotalLeaveAccumulated($data['user_id'], $selected_year);
                 $leave_request = $this->leave_model->getLeaveRequestByID($request_id);
                 $leave_request->start_date = dateFormat($leave_request->start_date);
                 $leave_request->end_date = dateFormat($leave_request->end_date);
                 $leave_request->start_time = timeFormat($leave_request->start_time);
                 $leave_request->end_time = timeFormat($leave_request->end_time);
                 $leave_request->applied_date = dateFormat($leave_request->applied_date);
                 $leave_request->leave_left = $total_leave_accumulated - ($total_leave_claimed + $total_leave_off_claimed);
                 $leave_request->leave_off_claimed = $total_leave_off_claimed;
                 if ($request_id) {
                     $user = $this->leave_model->getFromId($this->input->post('staff_id'), 'id', IMS_DB_PREFIX . 'user');
                     global $_current_centre_role;
                     $centre_admin = centre_admin($_current_centre_role->centre_id);
                     if (!empty($centre_admin)) {
                         $subject = 'A new leave is requested.';
                         // $message = '<p>' . $centre_admin->first_name . ',</p>'
                         //         . '<p>Leave have been requested'
                         //         . 'by : ' . $user->first_name . ' ' . $user->last_name . '</p>'
                         //         . '<p>From : ' . $this->input->post('start_date') . '</p>'
                         //         . '<p>To : ' . $this->input->post('end_date') . '</p>'
                         //         . '<p>Waiting for your approval!</p>';
                         $leave_type_name = $this->leave_model->select('leave_type')->getOneWhere(array('id' => $this->input->post('leave_type_id')), IMS_DB_PREFIX . 'leave_types')->leave_type;
                         $message = "<p>{name_of_superior},</p>" . "<p>{leave_type} application has been submitted by: {name_of_subordinate}</p>" . "<p>From : {from_start_date} {from_start_time}</p>" . "<p>To : {to_start_date} {to_start_time}</p>" . "<a href='{link_to_leave_application}'>Please review the leave application here</a>";
                         $leave_info = array('name_of_superior' => $centre_admin->first_name, 'leave_type' => $leave_type_name, 'name_of_subordinate' => $user->first_name . ' ' . $user->last_name, 'from_start_date' => $this->input->post('start_date'), 'from_start_time' => $this->input->post('start_time'), 'to_start_date' => $this->input->post('end_date'), 'to_start_time' => $this->input->post('end_time'), 'link_to_leave_application' => site_url("leave/leave_manage"));
                         $this->load->library('parser');
                         $message = $this->parser->parse_string($message, $leave_info, TRUE);
                         // die($message);
                         $this->send_mail($centre_admin->email, 'Centre Admin', $subject, $message);
                     }
                     die(json_encode(array('status' => 'success', 'msg' => 'Leave Application Submitted Successfully.', 'data' => $leave_request)));
                 } else {
                     die(json_encode(array('status' => 'error', 'msg' => 'Cannot Submit Leave Application. Please try again later.')));
                 }
             }
         } else {
             $response = array('status' => 'validation_error', 'error' => array());
             if (form_error('leave_type_id')) {
                 $response['error']['leave_type_id'] = form_error('leave_type_id');
             }
             if (form_error('start_date')) {
                 $response['error']['start_date'] = form_error('start_date');
             }
             if (form_error('end_date')) {
                 $response['error']['end_date'] = form_error('end_date');
             }
             if (form_error('start_time')) {
                 $response['error']['start_time'] = form_error('start_time');
             }
             if (form_error('end_time')) {
                 $response['error']['end_time'] = form_error('end_time');
             }
             die(json_encode($response));
         }
     }
 }
Пример #17
0
 public function new_job_list($limit, $title = '')
 {
     if (empty($title)) {
         $sql = "select * from stj_job where stj_job.is_show=1 and stj_job.employ>(select count(*) from stj_record where stj_record.j_id = stj_job.id and audstart=6) and checkinfo='true' and endtime>unix_timestamp(now()) and is_deleted=0 order by orderid asc, checktime desc ,starttime desc limit {$limit}";
     } else {
         //关键词模糊查询
         $keywordGroup = M("keyword_group")->where("keyword_group like '%" . $title . "%'")->getField("keyword_group");
         if ($keywordGroup) {
             $arKeywordGroup = explode(" ", $keywordGroup);
             $titleTmp = "";
             foreach ($arKeywordGroup as $keyword) {
                 if ($keyword) {
                     $titleTmp .= " or title like '%" . $keyword . "%' ";
                 }
             }
         }
         if (strlen($titleTmp) > 0) {
             $where .= " (title like '%" . $title . "%' " . $titleTmp . ")  ";
         } else {
             $where .= " (title like '%" . $title . "%')  ";
         }
         $sql = "select * from stj_job where  {$where} and stj_job.is_show=1 and stj_job.employ>(select count(*) from stj_record where stj_record.j_id = stj_job.id and audstart=6) and checkinfo='true' and endtime>unix_timestamp(now()) and is_deleted=0 order by orderid asc, checktime desc ,starttime desc limit {$limit}";
     }
     $return_data = $this->table('stj_job job')->query($sql);
     //echo "<pre>";var_dump($return_data);echo"</pre>";
     //得到岗位名称信息
     foreach ($return_data as $k => $v) {
         $com_sql = "select com.cpname,com.id cpid from stj_company com where  com.id=" . $v['cpid'];
         //关联公司信息
         $cas_sql = "select cas.cascname from stj_casclist cas where cas.id=" . $v['jobplace'];
         //关联casclist
         $recommended_sql = "select count(*) as num from stj_record where stj_record.j_id = {$v['id']}";
         //echo $recommended_sql;die;
         $return_data_com = $this->table('stj_company com')->query($com_sql);
         //echo"<pre>";var_dump($return_data_com);echo"</pre>";
         $return_data_cas = $this->table('stj_casclist cas')->query($cas_sql);
         //echo"<pre>";var_dump($return_data_cas);echo"</pre>";
         $recommendedArr = $this->table('stj_record')->query($recommended_sql);
         foreach ($return_data_com[0] as $k1 => $v1) {
             $return_data[$k][$k1] = $v1;
         }
         foreach ($return_data_cas[0] as $k1 => $v1) {
             $return_data[$k][$k1] = $v1;
         }
         $return_data[$k]['recommendednum'] = $recommendedArr[0]['num'];
         $return_data[$k]['posttimedata'] = timeFormat($return_data[$k]['posttime'], $format = 'Y-m-d');
         $return_data[$k]['starttimedata'] = timeFormat($return_data[$k]['starttime'], $format = 'Y-m-d');
         $return_data[$k]['posttimedata'] = $return_data[$k]['checktime'] != 0 ? timeFormat($return_data[$k]['checktime'], $format = 'Y-m-d') : timeFormat($return_data[$k]['starttime'], $format = 'Y-m-d');
         //得到 职位名称 数据
         if (empty($return_data[$k]['title'])) {
             $return_data[$k]['title'] = getCascList($return_data[$k]['Jobcate'], "信息不明");
         }
         //得到 薪资待遇 数据
         $treatmentdata = getCascData('treatment', $return_data[$k]['treatment'], "信息不明");
         $arTreatmentdata = explode("-", str_replace("元", "", $treatmentdata));
         //$return_data[$k]['treatmentdata'] = ($arTreatmentdata[0] / 1000) . "K-" . ($arTreatmentdata[1] / 1000) . "K";
         if (count($arTreatmentdata) == 1) {
             $return_data[$k]['treatmentdata'] = "80K以上";
         } else {
             $return_data[$k]['treatmentdata'] = $arTreatmentdata[0] / 1000 . "K-" . $arTreatmentdata[1] / 1000 . "K";
         }
         //得到 工作经验 数据
         $experiencedata = getCascData('experience', $return_data[$k]['experience'], "信息不明");
         $return_data[$k]['experiencedata'] = $experiencedata;
         //招聘资费处理
         if ($return_data[$k]['Tariff'] > 10) {
             $return_data[$k]['Tariff'] = floor($return_data[$k]['Tariff'] * 0.8 / 100) * 100;
         } else {
             $return_data[$k]['Tariff'] = floor($return_data[$k]['treatment'] * $return_data[$k]['Tariff'] * 12 * 0.8 / 100) * 100;
         }
         //发布时间
         $return_data[$k]['starttime'] = $return_data[$k]['checktime'] != 0 ? date('Y-m-d', $return_data[$k]['checktime']) : date('Y-m-d', $return_data[$k]['starttime']);
         //echo "<pre>";var_dump($return_data);echo"</pre>";
     }
     //echo "<pre>";var_dump($return_data[0]);echo"</pre>";
     return $return_data;
 }
Пример #18
0
 public static function debug($title, $data, $key = 'log')
 {
     $log = ['time' => timeFormat(time()), 'title' => $title, 'data' => $data];
     $redis = DXUtil::redisClient();
     $redis->lpush($key, json_encode($log));
 }