Exemple #1
0
 public static function send(\Impro\Team\Training $training, \Impro\Team\Member $member)
 {
     if ($member->has_right(\Impro\Team\Member\Role::PERM_TEAM_ATTENDANCE)) {
         $ack = \Impro\Team\Training\Ack::create(array("status" => self::NOT_SENT, "training" => $training, "member" => $member, "user" => $member->user));
         $invite = \Impro\User\Alert::generate(array('allow_maybe' => true, 'author' => $training->author, 'generated_by' => 'organic-invite', 'member' => $member, 'request' => $training->request, 'team' => $training->team, 'template' => \Impro\User\Alert::TEMPLATE_INVITE_TRAINING, 'training' => $training, 'training_ack' => $ack->id, 'type' => \Impro\User\Alert::TYPE_REQUEST, 'user' => $member->user));
         if ($invite->status == \Impro\User\Alert::STATUS_SENT) {
             $ack->status = self::SENT;
             $ack->save();
         }
         return $ack;
     }
 }
 public function can_be($method, \System\User $user)
 {
     $member = \Impro\Team\Member::get_first()->where(array('id_system_user' => $user->id, 'id_impro_team' => $this->team->id))->fetch();
     if ($method == \System\Model\Perm::BROWSE) {
         return true;
     }
     return $user->is_root() || in_array(ID_MANAGER, $member->roles) || in_array(ID_TRAINER, $member->roles);
 }