本文整理汇总了PHP中Calendar::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::model方法的具体用法?PHP Calendar::model怎么用?PHP Calendar::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::model方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModel
public function loadModel($id)
{
$model = Calendar::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例2: getGroupCalendars
public function getGroupCalendars()
{
$findParams = \GO\Base\Db\FindParams::newInstance()->select('t.*')->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('view_id', $this->id, '=', 'vgr'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\User', 'localField' => 'user_id', 'tableAlias' => 'usr'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\UserGroup', 'localField' => 'user_id', 'foreignField' => 'user_id', 'tableAlias' => 'usg'));
$findParams->joinModel(array('model' => 'GO\\Base\\Model\\Group', 'localField' => 'group_id', 'localTableAlias' => 'usg', 'tableAlias' => 'grp'));
$findParams->joinModel(array('model' => 'GO\\Calendar\\Model\\ViewGroup', 'localField' => 'id', 'localTableAlias' => 'grp', 'foreignField' => 'group_id', 'tableAlias' => 'vgr', 'criteria' => \GO\Base\Db\FindCriteria::newInstance()->addCondition('view_id', $this->id, '=', 'vgr')));
return Calendar::model()->find($findParams);
}
示例3: __construct
/**
* Constructor
*
* @param string $startDate
* @param string $endDate
*/
public function __construct($startDate, $endDate)
{
$this->startDate = $startDate;
$this->endDate = $endDate;
$this->calendars = Calendar::model()->find()->fetchAll();
$findParams = \GO\Base\Db\FindParams::newInstance()->join('cal_events', \GO\Base\Db\FindCriteria::newInstance()->addRawCondition('t.id', 'e.category_id'), 'e')->group('t.id')->having('count(*)>0');
$calendars = array(0);
foreach ($this->calendars as $calendar) {
$calendars[] = $calendar->id;
}
$findParams->getCriteria()->addInCondition('calendar_id', $calendars);
$this->categories = Category::model()->find($findParams)->fetchAll();
//GLOBAL
}
示例4: actionUpdatedue
public function actionUpdatedue()
{
if (Project::model()->updateByPk($_GET['id'], array('due_date' => "{$_GET['nilai']}"))) {
$data = Calendar::model()->find("project_id = {$_GET['id']} and type='due' ");
$data->due_date = $_GET['nilai'];
if ($data->save()) {
echo "sukses";
}
} else {
echo "id : " . $_REQUEST['id'];
echo "nilai : " . $_REQUEST['nilai'];
}
}
示例5:
echo '<a href="/id' . $data->id . '" class="cat-photo-img__link last"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>';
} else {
echo '<a href="/id' . $data->id . '" class="cat-photo-img__link"><img class="cat-photo-img" src="/img/zaglushka.png" alt="' . $data->name . ' - ' . Occupation::getName($data->occupation_id) . '"></a>';
}
$i++;
}
}
?>
</div>
</section>
<?php
}
//if($res==0) echo Yii::t('category','No results found.');
} else {
if (!empty($_POST['calend'])) {
$is_busy = Calendar::model()->countByAttributes(array('uid' => $data->id, 'day' => $_POST['calend']));
if ($is_busy <= 0) {
$_SESSION['res_'] = $_SESSION['res_'] + 1;
?>
<section class="wrapper photo-item">
<div class="container">
<div class="cat-item-header">
<a href="/id<?php
echo $data->id;
?>
"><h4 class="cat-item-user"><?php
echo $data->name;
?>
</h4></a>
<div class="cat-item-accaunt <?php
echo $data->member_type;
示例6: getDefaultCalendar
/**
* Get's the participant's default calendar if it has one.
* @return Calendar
*/
public function getDefaultCalendar()
{
if (empty($this->user_id)) {
return false;
}
return Calendar::model()->findDefault($this->user_id);
}
示例7: date
echo Yii::app()->homeUrl;
?>
xo-so-mien-trung.html" class="btn btn-trung">Xổ Số Miền Trung</a>
<div class="clearfix"></div>
<?php
$this->renderPartial("_tablemien");
?>
<br />
<?php
$day = date("l", time());
$date = date("d-m-Y", time());
if (date("H", time()) < 16 || date("H", time()) == 16 && date("i", time()) <= 10) {
$day = date("l", time() - 86400);
$date = date("d-m-Y", time() - 86400);
}
$data = Calendar::model()->find("thu = :thu", array(":thu" => $day));
$nam = explode(",", $data->nam);
$trung = explode(",", $data->trung);
$bac = explode(",", $data->bac);
//nam
$criterianam = new CDbCriteria();
$criterianam->condition = 'date=:date';
$criterianam->params = array(':date' => $date);
$criterianam->addInCondition("provice", $nam);
$nam = KqxsNam::model()->findAll($criterianam);
?>
<div class="panel panel-danger kq">
<div class="panel-heading">Kết quả xổ số Miền Nam - <?php
echo $date;
?>
示例8: actionOnlinebac
public function actionOnlinebac()
{
$day = date("l", time());
$date = date("d-m-Y", time());
$data = Calendar::model()->find("thu = :thu", array(":thu" => $day));
$nam = explode(",", $data->nam);
$trung = explode(",", $data->trung);
$bac = explode(",", $data->bac);
//nam
$criterianam = new CDbCriteria();
$criterianam->condition = 'date=:date';
$criterianam->params = array(':date' => $date);
$criterianam->addInCondition("provice", $bac);
$resultnam = KqxsBac::model()->findAll($criterianam);
$this->render("onlinemienbac", array('bac' => $resultnam));
}
示例9: actionMn
public function actionMn()
{
$day = date("l", time());
$data = Calendar::model()->find("thu = :thu", array(":thu" => $day));
$nam = explode(",", $data->nam);
$trung = explode(",", $data->trung);
$bac = explode(",", $data->bac);
$url = 'http://minhngoc.net.vn/xstt/MN/MN.php?visit=0';
$content = file_get_contents($url);
$arr = explode(";", $content);
$ret = array();
foreach ($arr as $item) {
$tmp = explode('=', $item);
$key = $tmp[0];
$key = str_replace('kqxs["', '', $key);
$key = str_replace('"]', '', $key);
$key = str_replace("\r\n", '', $key);
$value = end($tmp);
$value = str_replace('"', '', $value);
$value = preg_replace('/[^0-9]/', '', $value);
$ret[$key] = $value;
}
if (date("d-m-Y", $ret["newtime"]) == date("d-m-Y", time())) {
$tinh = explode(",", $ret["listtinhnew"]);
$date = date("d-m-Y", time());
foreach ($nam as $province) {
$pro = CommonHelper::maprev($province);
unset($ret["\r\nT" . $pro . "_LV"]);
unset($ret["\r\n"]);
$proexist = KqxsNam::model()->find("date=:date and provice=:provice", array(":date" => $date, ":provice" => $province));
if (!$proexist) {
$model = new KqxsNam();
$model->date = $date;
$model->provice = $province;
$model->db = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_Gdb"]);
$model->nhat = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G1"]);
$model->nhi = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G2"]);
$model->ba1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G3_1"]);
$model->ba2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G3_2"]);
$model->tu1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_1"]);
$model->tu2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_2"]);
$model->tu3 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_3"]);
$model->tu4 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_4"]);
$model->tu5 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_5"]);
$model->tu6 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_6"]);
$model->tu7 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_7"]);
$model->nam = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G5"]);
$model->sau1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_1"]);
$model->sau2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_2"]);
$model->sau3 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_3"]);
$model->bay = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G7"]);
$model->tam = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G8"]);
$model->insert();
} else {
$proexist->db = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_Gdb"]);
$proexist->nhat = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G1"]);
$proexist->nhi = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G2"]);
$proexist->ba1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G3_1"]);
$proexist->ba2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G3_2"]);
$proexist->tu1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_1"]);
$proexist->tu2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_2"]);
$proexist->tu3 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_3"]);
$proexist->tu4 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_4"]);
$proexist->tu5 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_5"]);
$proexist->tu6 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_6"]);
$proexist->tu7 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G4_7"]);
$proexist->nam = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G5"]);
$proexist->sau1 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_1"]);
$proexist->sau2 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_2"]);
$proexist->sau3 = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G6_3"]);
$proexist->bay = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G7"]);
$proexist->tam = preg_replace('/[^A-Za-z0-9]/', '', $ret["T" . $pro . "_G8"]);
$proexist->update();
}
}
}
$this->renderJSON($ret);
}
示例10: actionCalendarChange
public function actionCalendarChange()
{
$action = Yii::app()->request->getParam('action', '');
$date = Yii::app()->request->getParam('date', '');
$m = Yii::app()->request->getParam('m', '');
$returnArray = array();
$status = false;
$switch = false;
$msg = '';
$dateObject = DateTime::createFromFormat('Y-m-d', $date);
if ($dateObject) {
$modelDate = new DateTime($date);
switch ($action) {
case 'makeUnavailable':
$switch = true;
$modelStatus = 1;
$modelType = 3;
break;
case 'makeAvailable':
$switch = true;
$modelStatus = 0;
$modelType = 3;
break;
case 'removeFlag':
$switch = true;
$modelStatus = 0;
$modelType = 1;
break;
case 'addFlag':
$switch = true;
$modelStatus = 1;
$modelType = 1;
break;
}
if ($switch) {
$model = Calendar::model()->find('calendar_date = "' . $modelDate->format('Y-m-d H:i:s') . '" AND calendar_type = "' . $modelType . '" AND created_by = ' . Yii::app()->user->getInfo());
if ($model == null) {
$model = new Calendar();
}
$model->status = $modelStatus;
$model->message = $m;
$model->calendar_type = $modelType;
$model->calendar_date = $modelDate->format('Y-m-d H:i:s');
$model->created_by = Yii::app()->user->getInfo();
if ($model->save()) {
$status = true;
$msg = 'Success';
} else {
$msg = $model->getErrors();
}
}
}
$returnArray['status'] = $status;
$returnArray['msg'] = $msg;
header('Content-Type: application/json');
$return = json_encode($returnArray);
echo $return;
Yii::app()->end();
}
示例11: foreach
foreach ($row as $i => $v) {
if ($i == 5 || $i == 6) {
if (!empty($v)) {
$cl = 'weekend__day';
} else {
$cl = 'other-month__day';
}
} else {
if (!empty($v)) {
$cl = '';
} else {
$cl = 'other-month__day';
}
}
if (!empty($v)) {
if (Calendar::model()->countByAttributes(array('uid' => $model->id, 'day' => $year_plus . "-" . $month . "-" . $v)) > 0) {
$cl .= " reserv__day";
$del1 = "1";
} else {
$del1 = "0";
}
} else {
$del1 = "0";
}
?>
<td class="<?php
echo $cl;
?>
">
<?php
echo $v ? $v : " ";
示例12: actionCalendar
public function actionCalendar()
{
// $this->layout = "//layouts/calendar";
Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/my-calendar.css");
Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . "/css/my-calendar-resp.css");
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/plugins/jQuery/jquery-ui.min.js", CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/plugins/fullcalendar/fullcalendar.js", CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/plugins/spin/spin.js", CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/main.js", CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/my-calendar.js", CClientScript::POS_END);
$returnArray = array();
$day = 60 * 60 * 24;
$time = time();
$from = Yii::app()->request->getParam('from', '');
$to = Yii::app()->request->getParam('to', '');
$criteria = new CDbCriteria();
$criteria->addCondition('mstRequestUsers.user_id = ' . Yii::app()->user->getInfo());
$criteria->addCondition('mstRequestUsers.archived = 0');
// $criteria->addCondition('booking_type > 0');
if (!empty($from)) {
$criteria->addCondition('bookingDate >= ' . $from);
}
if (!empty($to)) {
$criteria->addCondition('bookingDate < ' . $to);
}
$criteria->with = array('mstRequestUsers');
$modelArray = Requests::model()->findAll($criteria);
$eventsArray = array();
$requestsTempArray = array();
foreach ($modelArray as $model) {
if ($model->booking_type > 0) {
$criteria = new CDbCriteria();
$criteria->select = 'sum(amount) as amount';
$criteria->addCondition('request_id = ' . $model->id);
$criteria->addCondition('status = 1');
$modelSum = Payments::model()->find($criteria);
$moneyPaid = (int) $modelSum->amount;
$eventsArray[] = array('id' => $model->id, 'creator' => $model->createdBy->firstName . ' ' . $model->createdBy->lastName, 'title' => ComponentString::showPart($model->map->name, 14), 'map' => ComponentString::showPart($model->map->name, 28), 'event_type' => $model->eventType->name, 'start_time' => date('H:i A', strtotime($model->start_time)), 'end_time' => date('H:i A', strtotime($model->end_time)), 'start' => $model->eventDate, 'dateName' => date('l, F d, Y', strtotime($model->eventDate)), 'allDay' => true, 'type' => $model->booking_type, 'daysTotal' => ceil((strtotime($model->eventDate) - strtotime($model->created_on)) / $day), 'daysLeft' => ceil((strtotime($model->eventDate) - $time) / $day), 'moneyPaid' => $moneyPaid, 'moneyTotal' => $model->amount);
} else {
$requestsTempArray[date('d-m-Y', strtotime($model->eventDate))][] = 1;
}
}
$criteria = new CDbCriteria();
$criteria->addCondition('
(LOWER(calendarType.name) = "flag" AND t.created_by = ' . Yii::app()->user->getInfo() . ') OR
(LOWER(calendarType.name) = "unavailable" AND t.created_by = ' . Yii::app()->user->getInfo() . ') OR
(LOWER(calendarType.name) = "holiday")
');
$criteria->addCondition('calendarType.status = 1');
$criteria->addCondition('t.status = 1');
$criteria->with = array('calendarType');
$modelArray = Calendar::model()->findAll($criteria);
$flagsArray = array();
$holidaysArray = array();
$unavailableArray = array();
foreach ($modelArray as $model) {
switch (strtolower($model->calendarType->name)) {
case 'flag':
$flagsArray[] = array('id' => $model->id, 'title' => ComponentString::showPart($model->message, 30), 'start' => $model->calendar_date);
break;
case 'holiday':
$holidaysArray[] = array('id' => $model->id, 'title' => $model->message, 'start' => $model->calendar_date);
break;
case 'unavailable':
$unavailableArray[] = array('id' => $model->id, 'title' => $model->message, 'start' => $model->calendar_date);
break;
}
}
$requestsArray = array();
foreach ($requestsTempArray as $key => $request) {
$requestsArray[$key] = count($request);
}
$returnArray['events'] = $eventsArray;
$returnArray['flags'] = $flagsArray;
$returnArray['requests'] = $requestsArray;
$returnArray['holidays'] = $holidaysArray;
$returnArray['unavailable'] = $unavailableArray;
$json = json_encode($returnArray);
Yii::app()->clientScript->registerScript('mapvar10', "var json='" . $json . "';", CClientScript::POS_HEAD);
$this->render('calendar');
}