public function cancel() { $this->status = "cancelled"; $invitations = VCInvitation::model()->findAllByAttributes(array("videoconference_id" => $this->id)); foreach ($invitations as $inv) { $invitee = User::model()->findByAttributes(array("id" => $inv->invitee_id)); VCInvitation::sendCancelNotification($this, $invitee->fname . " " . $invitee->lname, $invitee->email); } return $this->save(); }
// 'update'=>'message', // 'success' => 'function(response) { // $(".message").html(response); // $("#mbox-'.$vc->id .'").remove(); // }', // ), // array( 'confirm'=>'Are you sure you want to delete this conference?', "visible" => $ismoderator, 'role' => "button", "class" => "btn btn-danger") // ); if ($vc->status != "cancelled") { $html .= CHtml::ajaxLink('Cancel', Yii::app()->createAbsoluteUrl('videoConference/cancel/' . $vc->id), array('type' => 'post', 'data' => array('id' => $vc->id, 'type' => 'post'), 'update' => 'message', 'success' => 'function(response) { $(".message").html(response); location.reload(); }'), array('confirm' => 'Are you sure you want to cancel this conference?', "visible" => $ismoderator, 'role' => "button", "class" => "btn btn-warning")); } } else { $invitation = VCInvitation::model()->findByAttributes(array('videoconference_id' => $vc->id, 'invitee_id' => $user->id)); if ($invitation->status == "Unknown") { $html .= accept($vc->id); $html .= reject($vc->id); } else { if ($invitation->status == "Accepted") { $html .= reject($vc->id); } else { $html .= accept($vc->id); } } } $html .= "</div>"; $html = str_replace("%SUBJECT%", $vc->subject, $html); $html = str_replace("%MSTATUS%", $vc->status, $html); $html = str_replace("%MSTATUS%", $vc->status, $html);
/** * Lists all models. */ public function actionIndex() { $user = User::model()->findByAttributes(array("username" => Yii::app()->user->getId())); $meetingsId = new CList(); $invitations = VCInvitation::model()->findAllByAttributes(array("invitee_id" => $user->id)); foreach ($invitations as $inv) { $meetingsId->add($inv->videoconference_id); } $meetings = VideoConference::model()->findAllByAttributes(array("moderator_id" => $user->id)); foreach ($meetings as $meeting) { $meetingsId->add($meeting->id); } //$dataProvider = new CActiveDataProvider('VideoConference'); $this->render('index', array('meetingsId' => $meetingsId->toArray())); }