コード例 #1
0
 public function actionSendUpdateNotifi()
 {
     $sender = $_POST['owner'];
     $typeid = $_POST['agendaID'];
     $type = $_POST['type'];
     $followmodel = new Follow();
     $recive = array();
     $recive = $followmodel->getfollowing($sender);
     for ($i = 0; $i < sizeof($recive); $i++) {
         $notificationModel = new Notification();
         $notificationModel->sender = $sender;
         $notificationModel->postID = $typeid;
         $notificationModel->type = $type;
         $notificationModel->seen = "0 ";
         $notificationModel->notified = $recive["studentID"][$i];
         $notificationModel->save();
     }
     $value = array('status' => "ok");
     return json_encode($value);
 }
コード例 #2
0
 public function getfollowing($staffID)
 {
     $status = array();
     $model = Follow::find()->where(['staffID' => $staffID])->all();
     if ($model == NULL) {
         $status["status"] = "null";
     } else {
         for ($i = 0; $i < sizeof($model); $i++) {
             $status["status"] = "ok";
             $status["studentID"][$i] = $model[$i]->studentID;
         }
     }
     return $status;
     //$result['studID'] = $model -> staffID ;
     //$result['staID'] = $model -> staffID ;
     // echo json_encode($result);
 }
コード例 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFollows()
 {
     return $this->hasMany(Follow::className(), ['staffID' => 'formalemail']);
 }
コード例 #4
0
ファイル: User.php プロジェクト: pyvil/yii-app
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFollows()
 {
     return $this->hasMany(Follow::className(), ['id_follow' => 'id']);
 }
コード例 #5
0
 public function actionGetfollowerpost()
 {
     $check_post = 0;
     $id = $_POST['id'];
     $follow = new Follow();
     $follow->studentID = $id;
     $model = array();
     $model = Follow::findAll(['studentID' => $id]);
     $status = array();
     $statuss = array();
     if ($model == Null) {
         $status["status"] = "faild";
         $statuss["status"] = "null";
     } else {
         $status["status"] = "ok";
         $statuss["status"] = "ok";
         for ($j = 0; $j < sizeof($model); $j++) {
             $status["follower"][$j] = $model[$j]->staffID;
         }
         $i = 0;
         $m = 0;
         $k = 0;
         for ($i = 0; $i < sizeof($model); $i++) {
             $staff_id = $model[$i]->staffID;
             $posts = array();
             $posts = Post::findAll(['owner' => $staff_id]);
             if ($posts == Null) {
                 //$statuss["status"]="faild";
                 $check_post++;
             } else {
                 $status["status"] = "ok";
                 $statuss["status"] = "ok";
                 for ($m = 0; $m < sizeof($posts); $m++) {
                     $name = "";
                     $statuss["content"][$k] = $posts[$m]->content;
                     //=$posts[$m] ->content;
                     $statuss["owner"][$k] = $posts[$m]->owner;
                     $name = StaffController::GetStaffName($statuss["owner"][$k]);
                     $statuss["name"][$k] = $name;
                     $statuss["time"][$k] = $posts[$m]->time;
                     $k++;
                 }
                 //$k += sizeof($posts);
             }
         }
     }
     if ($check_post == sizeof($model)) {
         $statuss["post"] = "null";
     } else {
         $statuss["post"] = "full";
     }
     return json_encode($statuss);
 }
コード例 #6
0
 public function Getfollowing($staffID)
 {
     $status = array();
     $model = Follow::find()->where(['staffID' => $staffID])->all();
     if ($model == NULL) {
         $status["status"] = "null";
     } else {
         for ($i = 0; $i < sizeof($model); $i++) {
             $status["status"] = "ok";
             $status["studentID"][$i] = $model[$i]->studentID;
         }
     }
     return $status;
 }