Esempio n. 1
0
 public function display()
 {
     \User::onlyHas('chat-view');
     $data = array('person' => \PersonModel::where('user_id', \Auth::user()->id)->first());
     if ($data['person']) {
         $tokenGen = new FireBaseAuth(\SettingsModel::one('firechat_key'));
         $data['token'] = $tokenGen->createToken(array("uid" => "person-{$data['person']->id}"), array("admin" => True));
         $data['person_lang'] = $data['person']->langs()->where('lang_id', \WebAPL\Language::getId())->first();
         return Template::moduleView($this->module_name, 'views.chat-display', $data);
     } else {
         throw new Exception('Person not found');
     }
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     $this->loadClass(array('PersonModel', 'PersonLangModel', 'PersonAudienceModel'));
     Template::registerViewMethod('page', 'group_with_persons', '', array($this, 'group_list'), true);
     Template::registerViewMethod('page', 'persons_with_photo', 'Persoane cu foto', array($this, 'photo_persons'), true);
     Template::registerViewMethod('page', 'persons_big', 'Persoane cu foto (viceprimari)', array($this, 'vicemayor'), true);
     Template::registerViewMethod('page', 'persons_mayor', 'Persoana cu foto (primar)', array($this, 'mayor'), true);
     Template::registerViewMethod('page', 'persons_secretar', 'Persoana cu foto (secretar)', array($this, 'secretar'), true);
     Template::registerViewMethod('page', 'city_councilors', 'Consilieri locali', array($this, 'councilors'), true);
     Shortcodes::register('person_subscribe', array($this, 'subscribe'));
     Route::post('person/subscribe_to_audience', array($this, 'subscribe_to_audience'));
     View::addNamespace('person', app_path('/modules/person/views'));
     $online_persons = \PersonModel::where('for_audience', 1)->get();
     $online_persons_arr = [];
     foreach ($online_persons as $person) {
         $online_persons_arr[] = $person->id;
     }
     View::share('online_persons', $online_persons_arr);
 }
Esempio n. 3
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');
 }