public function loadModel($id)
 {
     $model = Announcement::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 2
0
 public function actionIndex()
 {
     //取出公告数据
     $notice = Announcement::model()->findAll(array('order' => 'create_time DESC', 'condition' => 'status=:status', 'params' => array(':status' => 2)));
     $notice = CJSON::decode(CJSON::encode($notice));
     Out::jsonOutput($notice);
 }
Ejemplo n.º 3
0
 public function actionLogin()
 {
     if (!Ibos::app()->user->isGuest) {
         $this->redirect(Ibos::app()->urlManager->createUrl("main/default/index"));
     }
     $account = UserUtil::getAccountSetting();
     if (!EnvUtil::submitCheck("loginsubmit", 1)) {
         $announcement = Announcement::model()->fetchByTime(TIMESTAMP);
         $data = array("assetUrl" => $this->getAssetUrl("user"), "lang" => Ibos::getLangSources(), "unit" => Ibos::app()->setting->get("setting/unit"), "account" => $account, "cookietime" => $account["cookietime"], "announcement" => $announcement, "loginBg" => LoginTemplate::model()->fetchAll("`disabled`= 0 AND `image`!=''"));
         $this->setTitle(Ibos::lang("Login page"));
         $this->renderPartial("login", $data);
     } else {
         $userName = EnvUtil::getRequest("username");
         $loginType = EnvUtil::getRequest("logintype");
         $passWord = EnvUtil::getRequest("password");
         $autoLogin = EnvUtil::getRequest("autologin");
         $cookieTime = EnvUtil::getRequest("cookietime");
         $this->doLogin($userName, $passWord, $loginType, $account, $autoLogin, $cookieTime);
     }
 }
Ejemplo n.º 4
0
 public function actionSystemNotice()
 {
     //查询出公告数据
     $notice = Announcement::model()->findAll(array('order' => 'create_time DESC', 'condition' => 'status=:status', 'params' => array(':status' => 2)));
     $notice = CJSON::decode(CJSON::encode($notice));
     foreach ($notice as $k => $v) {
         $notice[$k]['create_time'] = date('Y-m-d', $v['create_time']);
     }
     $this->render('systemnotice', array('announce' => $notice));
 }
Ejemplo n.º 5
0
 /**
 * Lists all models.
 */
 public function actionDashboard()
 {
     if (isset(Yii::app()->session['login']['id'])) {
         $userid = Yii::app()->session['login']['id'];
         if (isset($_REQUEST['frndid'])) {
             $frndid = $_REQUEST['frndid'];
             if ($frndid != $userid) {
                 $userid = $frndid;
             }
         }
     } else {
         if (isset($_REQUEST['frndid'])) {
             $frndid = $_REQUEST['frndid'];
             /*This code is added for making specific profiles public*/
             $profiles = array(64, 124, 16, 101, 100, 99, 279, 280, 255, 115, 265, 449, 270, 371, 248, 241, 63, 246, 239, 106, 68, 193, 289, 67, 107, 597, 362, 303, 256, 333);
             if (in_array($frndid, $profiles)) {
                 $userid = $frndid;
             } else {
                 $this->redirect(array('/home'));
             }
         } else {
             $this->redirect(array('/home'));
         }
     }
     if (isset($_REQUEST['share'])) {
         $share = "share";
     } else {
         $share = "no";
     }
     if ($_REQUEST['groupid']) {
         $isgroup = $_REQUEST['groupid'];
     } else {
         $isgroup = '';
         $this->redirect(array('/home'));
     }
     if (isset($_REQUEST['getusertileid']) || isset($_REQUEST['tileerrormesg'])) {
         if (isset($_REQUEST['tileerrormesg'])) {
             $getusertileid = $_REQUEST['tileerrormesg'];
         } else {
             if ($_REQUEST['getusertileid']) {
                 $getusertileid = $_REQUEST['getusertileid'];
             }
         }
         $tileid = $getusertileid;
     } else {
         $tileid = "";
         $getusertileid = "";
     }
     if ($_REQUEST['upload']) {
         $upload = 1;
     }
     if ($_REQUEST['errormsg']) {
         $errormsg = $_REQUEST['errormsg'];
     }
     $groupinfo = Group::model()->findByPK($isgroup);
     $isuploadprocess = array();
     if (isset($_REQUEST["finaoid"])) {
         $sourcetype = $_REQUEST["sourcetype"];
         $finid = 0;
         $journalid = 0;
         if ($sourcetype == 'journal') {
             $finaojournal = UserFinaoJournal::model()->findByPK($_REQUEST["finaoid"]);
             if (isset($finaojournal) && !empty($finaojournal)) {
                 $finid = $finaojournal->finao_id;
             }
             $journalid = $_REQUEST["finaoid"];
         } else {
             $finid = $_REQUEST["finaoid"];
         }
         $finao = UserFinaoTile::model()->find(array('condition' => 'finao_id = ' . $finid));
         $tileid = "";
         if (isset($finao) && count($finao) >= 1) {
             $tileid = $finao->tile_id;
         }
         $isuploadprocess = array('finao' => $finid, 'tile' => $tileid, 'share' => $share, 'journalid' => $journalid, 'upload' => $_REQUEST['upload'], 'menuselected' => isset($_REQUEST['menuselected']) ? $_REQUEST['menuselected'] : "");
     }
     //$tilesslider = $this->refreshtilewidget($userid,$share,0,0,1);
     $Criteria = new CDbCriteria();
     $Criteria->condition = "`group_id` = " . $isgroup . " and `finao_activestatus` = 1 and `updatedby` = " . $userid . " and Iscompleted = 0";
     if ($userid != Yii::app()->session['login']['id'] || $share == "share") {
         $Criteria->addCondition("finao_status_Ispublic = 1", 'AND');
     }
     $Criteria->order = "updateddate DESC";
     $groupfinaos = UserFinao::model()->findAll($Criteria);
     foreach ($groupfinaos as $finodet) {
         $finaoids .= $finodet->user_finao_id . ",";
     }
     if ($finaoids != "") {
         $finaoids = substr($finaoids, 0, strlen($finaoids) - 1);
         $finaouploaddetails = $this->getlatestuploaddetails($finaoids, 61);
     }
     $tilesslider = $this->refreshtilewidget($userid, $isgroup, $share, 0, 0, 1);
     $members = $this->getmembersdetails($userid, $isgroup, 0, 0);
     $memcount = count($members, 0);
     $trackingyoudet = TrackingController::displayYourGroupTracking($userid, $share, "trackingyou", "", $isgroup);
     $result = GroupTracking::model()->findByAttributes(array('tracker_userid' => Yii::app()->session['login']['id'], 'tracked_groupid' => $isgroup, 'tracked_userid' => $userid));
     if (count($result) == '0') {
         $results = 'Join Group';
         $isgroupmem = 0;
         //Not a member
     } else {
         $results = 'Leave Group';
         $isgroupmem = 1;
         // Member
     }
     //archived finaos
     $archivefinao = $this->getfinaoinfo($userid, $isgroup, "completed", $share, -1, 1, 0);
     // tile info
     $userprofarray = $this->getUserProfile($userid, $share, $isgroup);
     $activityppl = $this->getmyheroesdata1($userid, $share);
     //print_r($groupfinaos);exit;
     //echo $groupfinaos['user_finao_id'];
     $result_tile_id = UserFinaoTile::model()->findByAttributes(array('finao_id' => $groupfinaos[0]['user_finao_id']));
     /*$announcements = Announcement::model()->findByAttributes(array('uploadsourcetype'=>61,
       'uploadsourceid'=>$isgroup
       )); */
     $Criteria = new CDbCriteria();
     $Criteria->condition = "uploadsourcetype = 61 and createdby = " . $userid . " and uploadsourceid = " . $isgroup . " ";
     $Criteria->order = "createddate DESC";
     $announcements = Announcement::model()->findAll($Criteria);
     $othergroups = FinaoController::getGroupinfo($userid, $share);
     $this->render('index', array('userid' => $userid, 'imgcount' => $this->GetTotalCount(0, $isgroup, $userid, 'Image', 0, $share), 'videocount' => $this->GetTotalCount(0, $isgroup, $userid, 'Video', 0, $share), 'finaocount' => $this->getfinaoinfo($userid, $isgroup, "", 'yes', -1, 1, 1), 'titlecount' => $tilesslider['totaltilecount'], 'followcount' => $this->getfollowersdetails($userid, -1, 0, 1), 'isgroup' => $isgroup, 'groupinfo' => $groupinfo, 'groupfinaos' => $groupfinaos, 'share' => $share, 'upload' => $upload, 'memcount' => $memcount, 'results' => $results, 'share' => $share, 'isuploadprocess' => $isuploadprocess, 'finaouploaddetails' => $finaouploaddetails, 'getusertileid' => $getusertileid, 'tileid' => $tileid, 'trackingyoudet' => $trackingyoudet, 'isgroupmem' => $isgroupmem, 'tilesinfo' => $userprofarray['tilesinfo'], 'archivefinao' => $archivefinao, 'activityppl' => $activityppl, 'errormsg' => $errormsg, 'result_tile_id' => $result_tile_id->tile_id, 'announcements' => $announcements, 'share_value' => $_REQUEST['share_value'], 'othergroups' => $othergroups['groupinfo']));
 }
Ejemplo n.º 6
0
<?php

$announcementId = is_numeric($data) ? $data : $data['announcementId'];
$announcement = Announcement::model()->findByPk($announcementId);
if ($announcement) {
    $course = $announcement->course;
}
// 如果Announcement 或 Course 不为空则跳过打印Notice
if (empty($announcement) || empty($coure)) {
    return;
}
echo '课程 ' . CHtml::link($course['name'], array('/course/index/view', 'id' => $course['id'])) . ' 发布了新公告 ';
echo CHtml::tag('em', array(), mb_substr($announcement->content, 0, 10, 'utf8'));
/** 通知详情,暂不使用
echo CHtml::link('&nbsp;&nbsp;&nbsp;[详情]', array('/course/announcement/detail', 'id'=>$announcement['id']), array('onclick'=>'openFancyBox(this);return false;'));
*/
Ejemplo n.º 7
0
<?php

$announcement = Announcement::model()->findByPk($data);
$course = Course::model()->findByPk($announcement['courseId']);
// 如果Announcement 或 Course 为空则跳过打印Notice
if (empty($announcement) || empty($course)) {
    return;
}
echo Yii::t('app', '课程 ') . CHtml::link($course['name'], array('/course/index/view', 'id' => $course['id'])) . Yii::t('app', ' 更新了公告 ');
echo CHtml::link('&nbsp;&nbsp;&nbsp;' . Yii::t('app', '[详情]'), array('/course/announcement/detail', 'id' => $announcement['id']), array('onclick' => 'openFancyBox(this);return false;'));
Ejemplo n.º 8
0
 private function announcementDelete($id)
 {
     return Announcement::model()->deleteById($id);
 }