Example #1
0
 protected static function personPrepare()
 {
     return PersonModel::join(PersonLangModel::getTableName(), PersonLangModel::getField("person_id"), '=', PersonModel::getField("id"))->join(PersonRelModel::getTableName(), PersonRelModel::getField("person_id"), '=', PersonModel::getField("id"))->leftJoin(Files::getTableName(), function ($join) {
         $join->on(Files::getField("module_id"), '=', PersonModel::getField("id"));
         $join->on(Files::getField("module_name"), '=', DB::raw("'person'"));
     })->where(PersonLangModel::getField("lang_id"), \WebAPL\Language::getId())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc');
 }
Example #2
0
 public function sendmail()
 {
     $session_id = \Session::get('chat_session_id');
     $html = \Input::get('messages');
     if ($session_id) {
         $chat = \FireChatSession::find($session_id);
         if ($chat) {
             $data['html'] = $html;
             $person = \PersonLangModel::where('person_id', $chat->person_id)->where('lang_id', \WebAPL\Language::getId())->first();
             Template::viewModule($this->module_name, function () use($data, $chat, $person) {
                 \Mail::send('views.email-mess', $data, function ($message) use($chat, $person) {
                     $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA');
                     $message->subject("Discutie on-line cu " . $person->first_name . " " . $person->last_name . " din " . date("Y-m-d H:i"));
                     $message->to($chat->user_email);
                 });
             });
         }
     }
 }
Example #3
0
 public function edit_item($id = 0)
 {
     \User::onlyHas('calendar-view');
     $data = array('calendar' => CalendarModel::find($id));
     if ($data['calendar']) {
         $langs = CalendarLangModel::where('calendar_item_id', $id)->get();
         $data['langs'] = array();
         foreach ($langs as $lang) {
             $data['langs'][$lang->lang_id] = $lang;
         }
         if (\WebAPL\Modules::checkInstance('person')) {
             $this->loadClass(['PersonLangModel'], 'person');
             $data['persons'] = \PersonLangModel::where('lang_id', Language::getId())->orderBy(\DB::raw(\PersonLangModel::getField('first_name') . ', ' . \PersonLangModel::getField('last_name')), 'asc')->get();
         }
         $data['groups'] = \CalendarGroup::orderBy('name', 'asc')->get();
         //            $data['posts'] = Post::join(PostLang::$ftable, PostLang::$ftable . ".post_id", '=', Post::$ftable . ".id")
         //                    ->select(CalendarPostModel::$ftable . ".post_id", CalendarPostModel::$ftable . ".calendar_item_id", PostLang::$ftable . ".title")
         //                    ->join(CalendarPostModel::$ftable, CalendarPostModel::$ftable . ".post_id", '=', Post::$ftable . ".id")
         //                    ->where(CalendarPostModel::$ftable . ".calendar_item_id", $id)
         //                    ->get();
         //
         //            $data['posts_all'] = Post::prepareAll()
         //                    ->select(PostLang::$ftable . ".title", Post::$ftable . ".id")
         //                    ->where(Post::$ftable . ".view_mod", $this->page_view_mod)
         //                    ->get();
         $this->layout->content = Template::moduleView($this->module_name, 'views.edit_form', $data);
         return $this->layout;
     } else {
         \App::abort(404);
     }
 }
Example #4
0
 public function deleteperson()
 {
     $id = Input::get('id');
     \PersonModel::where('id', $id)->delete();
     \PersonLangModel::where('person_id', $id)->delete();
     \Files::dropMultiple('person', $id);
     \Files::dropMultiple('person_chat', $id);
     \PersonRelModel::where('person_id', $id)->delete();
     return \Illuminate\Support\Facades\Redirect::to('person/list');
 }