init() публичный Метод

Initialization.
public init ( )
Пример #1
0
 function init()
 {
     parent::init();
     if (!$this->skip_var) {
         $this->skip_var = $this->name . '_skip';
     }
 }
Пример #2
0
 function init()
 {
     parent::init();
     $this->js('reload')->reload();
     $vp = $this->add('VirtualPage');
     $vp->set(function ($vp) {
         $this->app->stickyGET('mark_id');
         $mark = $this->add('xepan\\communication\\Model_Communication_AbstractMessage');
         $mark->load($_POST['mark_id']);
         $einfo = $mark['extra_info'];
         $einfo['seen_by'][] = $this->app->employee->id;
         $mark['extra_info'] = $einfo;
         $mark->save();
         exit;
     });
     $this->js('click', [$this->js()->_selectorThis()->parent()->find('.text')->toggle('hide'), $this->js()->_selectorThis()->removeClass('unread'), $this->js()->_selectorThis()->univ()->ajaxec($vp->getURL(), ['mark_id' => $this->js()->_selectorThis()->data('id')])])->_selector('.internal-conversion-lister .name');
     $delete_id = $this->app->stickyGET('do_delete_employee_id');
     if ($delete_id) {
         $delete_m = $this->add('xepan\\communication\\Model_Communication_AbstractMessage');
         $delete_m->addCondition('id', $delete_id);
         $delete_m->tryLoadAny();
         if ($delete_m->loaded()) {
             $delete_m->delete();
         }
         $this->js(null, $this->js()->univ()->successMessage('Deleted Successfully'))->_selector('.internal-conversion-lister')->trigger('reload')->execute();
     }
     $this->on('click', '.do-delete-conversion')->univ()->confirm('Are you sure?')->ajaxec(array($this->app->url(), 'do_delete_employee_id' => $this->js()->_selectorThis()->data('id')));
 }
Пример #3
0
 function init()
 {
     parent::init();
     //$this->add('Reloadable');
     $this->api->addHook('pre-render', array($this, 'precacheTemplate'));
     $this->sortby = $this->learn('sortby', @$_GET[$this->name . '_sort']);
 }
Пример #4
0
 function init()
 {
     parent::init();
     // $m = $this->add('xepan\production\Model_Jobcard')->load(1903);
     // $m = $m->orderItem()->deptartmentalStatus();
     // $this->setModel($m);
 }
Пример #5
0
 function init()
 {
     parent::init();
     if (!$this->skip_var) {
         $this->skip_var = $this->name . '_skip';
     }
     $this->skip_var = $this->_shorten($this->skip_var);
 }
Пример #6
0
 function init()
 {
     parent::init();
     $total_alerts = $this->api->current_website->ref('Alerts')->count()->getOne();
     $new_alerts = $this->api->current_website->ref('Alerts')->addCondition('is_read', false)->count()->getOne();
     $this->template->trySet('total_alerts', $total_alerts);
     $this->template->trySet('new_alerts', $new_alerts);
     $b = $this->add('Button', null, 'viewAll')->setHTML('View All');
     // if($b->isClicked())
 }
Пример #7
0
 function init()
 {
     parent::init();
     // throw new \Exception($this->options['custom_template'], 1);
     $model = $this->add('xepan\\commerce\\Model_Category');
     $model->addCondition($model->dsql()->orExpr()->where('parent_category_id', 0)->where('parent_category_id', null))->addCondition('status', 'Active')->addCondition('is_website_display', true);
     $model->setOrder('display_sequence', 'desc');
     $this->setModel($model);
     $this->add('xepan\\cms\\Controller_Tool_Optionhelper', ['options' => $this->options, 'model' => $model]);
 }
Пример #8
0
 function init()
 {
     if ($this->template->is_set('current')) {
         $this->current_menu_class = $this->template->get('current');
         $this->inactive_menu_class = '';
         $this->template->del('current');
         $this->class_tag = 'current';
     }
     parent::init();
 }
Пример #9
0
 function init()
 {
     parent::init();
     $total_messages = $this->api->current_website->ref('Messages')->count()->getOne();
     $msg = $this->add('Model_Messages');
     $msg->addCondition($msg->_dsql()->orExpr()->where('is_read', false)->where('watch', true));
     $new_messages = $msg->count()->getOne();
     $this->template->trySet('total_messages', $total_messages);
     $this->template->trySet('new_messages', $new_messages);
     $b = $this->add('Button', null, 'viewInbox')->setHTML('View Inbox');
 }
Пример #10
0
 function init()
 {
     parent::init();
     if ($this->pop) {
         if ($this->pop instanceof jQuery_Chain) {
             $this->on('click', '.do-cog', $this->pop);
         } else {
             $this->on('click', '.do-cog', $this->pop->showjS(array('width' => $this->pop_width ?: 450, 'my' => 'right top', 'at' => 'right+5 bottom+5', 'arrow' => 'vertical top right')));
         }
     } else {
         $this->template->tryDel('cog');
     }
 }
Пример #11
0
 function init()
 {
     parent::init();
     $vp_edit = $this->add('VirtualPage');
     // $this->js(true)->univ()->frameURL('MyPopup',$vp->getURL());
     $vp_edit->set(function ($vp_edit) {
         $vp_edit->add('View_Info')->set($_GET['row_id']);
     });
     $this->js('click', $this->js()->univ()->frameURL('Edit Todo', [$vp_edit->getURL(), 'row_id' => $this->js()->_selectorThis()->closest('li')->attr('data-id')]))->_selector('.todo-edit');
     // $this->js()->univ()->alert($this->js()->_selectorThis()->closest('li')->attr('data-id'))
     $this->on('click', '.svc-todo-add', function ($js, $data) {
         return $js->univ()->frameURL('Add Rule', $this->api->url('addrule'));
     });
 }
Пример #12
0
 function init()
 {
     parent::init();
     $this->js('reload')->reload();
     // get new unread notifications
     // append them in template by js
     $notifications = $this->add('xepan\\base\\Model_Activity');
     // $notifications->addCondition('id','>',$this->app->employee['notified_till']?:0);
     $notifications->addCondition('notify_to', 'like', '%"' . $this->app->employee->id . '"%');
     $notifications->setOrder('id', 'desc');
     $this->setModel($notifications)->setLimit(5);
     $notifications = $this->add('xepan\\base\\Model_Activity');
     $notifications->addCondition('id', '>', $this->app->employee['notified_till'] ?: 0);
     $notifications->addCondition('notify_to', 'like', '%"' . $this->app->employee->id . '"%');
     $this->template->setHTML('icon', 'envelope-o');
     $this->template->set('notification_count', $notifications->count()->getOne());
     $this->template->set('unread_notification', $notifications->count()->getOne());
     if ($this->app->recall('mute_all_notification', false)) {
         $this->template->trySet('notif-class', 'fa fa-play');
         $this->template->trySet('notif-text', 'Play Notifications');
     } else {
         $this->template->trySet('notif-class', 'fa fa-pause');
         $this->template->trySet('notif-text', 'Pause Notifications');
     }
     if ($_GET['notification_mute_toggle']) {
         if ($this->app->recall('mute_all_notification', false)) {
             $this->app->memorize('mute_all_notification', false);
         } else {
             $this->app->memorize('mute_all_notification', true);
         }
         $this->js()->_selector('.xepan-notification-view')->trigger('reload')->execute();
     }
     $this->js('click', $this->js()->univ()->ajaxec($this->api->url('.', ['notification_mute_toggle' => true])))->_selector('.play-pause-notifications');
     if ($this->app->getConfig('websocket-notifications', false)) {
         if (!$this->app->recall('mute_all_notification', false)) {
             $this->app->js(true)->_load('websocketclient')->univ()->runWebSocketClient($this->app->getConfig('websocket-server', false), $this->app->current_website_name . '_' . $this->app->employee->id);
         }
         $this->app->js(true, '$.wakeUp(function(sleep_time){' . (string) $this->app->js()->reload() . '});')->_load('jquery.wakeup');
     } else {
         // No WebSocket implemented, keep 2 minute refresh method activated
         $this->js(true)->univ()->setInterval($this->js()->univ()->ajaxec($this->api->url('xepan_hr_notificationexec'))->_enclose(), 120000);
     }
     // $this->on('click','.play-pause-notifications',function($js,$data){
     // 	if($this->app->recall('mute_all_notification',false))
     // 		$this->app->memorize('mute_all_notification',false);
     // 	else
     // 		$this->app->memorize('mute_all_notification',true);
     // 	return $this->js()->_selector('.xepan-notification-view')->trigger('reload');
     // });
 }
Пример #13
0
 function init()
 {
     parent::init();
     $temp_array = [];
     foreach ($this->actions as $value) {
         $temp_array[] = ['action' => $value, 'action_title' => ucwords(str_replace("_", " ", $value)), 'row_id' => $this->id];
     }
     $this->setSource($temp_array);
     $this->template->setHtml('status', $this->status);
     $this->template->set('status_label', $this->setLabelColor($this->status));
     if ($this->action_btn_group) {
         $this->template->set('action_btn_group', $this->action_btn_group);
     }
     if (empty($temp_array)) {
         $this->template->del('dropdown');
         $this->template->set('col_span', '12');
     }
 }
Пример #14
0
 function init()
 {
     parent::init();
     $this->api->addHook('pre-exec', array($this, 'applyHook'), 1);
     $this->skip = $this->learn('skip', @$_GET[$this->name . '_skip']) + 0;
 }
Пример #15
0
 function init()
 {
     parent::init();
     if (!$this->contact_id) {
         return;
     }
     $this->addClass('xepan-communication-lister');
     $this->js('reload')->reload();
     $self = $this;
     $self_url = $this->app->url(null, ['cut_object' => $this->name]);
     $vp = $this->add('VirtualPage');
     $vp->set(function ($p) use($self, $self_url) {
         $contact_id = $this->api->stickyGET('contact_id');
         $model_contact = $this->add('xepan\\base\\Model_Contact');
         $model_contact->load($contact_id);
         $edit_id = $this->app->stickyGET('edit_communication_id');
         $form = $p->add('xepan\\communication\\Form_Communication', ['edit_communication_id' => $edit_id], null, ['form/empty']);
         $form->setContact($model_contact);
         $member_phones = array_reverse($model_contact->getPhones());
         $to_email_field = $form->getElement('email_to');
         $form->getElement('notify_email_to')->set(implode(", ", $model_contact->getEmails()));
         $called_to_field = $form->getElement('called_to');
         $edit_model = $this->add('xepan\\communication\\Model_Communication_Abstract_Email');
         if ($edit_id) {
             $edit_model->load($edit_id);
             $edit_emails_to = [];
             foreach ($edit_model['to_raw'] as $flipped) {
                 $edit_emails_to[] = $flipped['email'];
             }
             $to_email_field->set(implode(", ", $edit_emails_to));
         } else {
             $to_email_field->set(implode(", ", $model_contact->getEmails()));
             $called_to_field->set(array_pop($member_phones));
         }
         if ($form->isSubmitted()) {
             try {
                 $this->api->db->beginTransaction();
                 $form->process();
                 $this->app->db->commit();
             } catch (\Exception $e) {
                 if ($this->api->db->inTransaction()) {
                     $this->api->db->rollback();
                 }
                 throw $e;
             }
             $form->js(null, $this->js()->_selector('.xepan-communication-lister')->trigger('reload'))->univ()->successMessage('Done')->closeDialog()->closeDialog()->execute();
         }
     });
     $this->js('click', $this->js()->univ()->dialogURL("NEW COMMUNICATION", $this->api->url($vp->getURL(), ['contact_id' => $this->contact_id])))->_selector('.create');
     $this->js('click', $this->js()->univ()->frameURL("SEND ALL COMMUNICATION", $this->api->url('xepan_communication_contactcommunications', ['contact_id' => $this->contact_id])))->_selector('.inform');
     $this->js('click', $this->js()->univ()->dialogURL("Edit  COMMUNICATION", [$this->api->url($vp->getURL(), ['contact_id' => $this->contact_id]), 'edit_communication_id' => $this->js()->_selectorThis()->data('id')]))->_selector('.do-view-edit-communication');
     /*=========Delete Communication================*/
     if ($do_delete_id = $this->app->stickyGET('do_delete_communication_id')) {
         $del_model = $this->add('xepan\\communication\\Model_Communication')->addCondition('id', $do_delete_id)->tryLoadAny();
         if ($del_model->loaded()) {
             $del_model->delete();
         }
         $this->app->page_action_result = $this->js(null, $this->js()->univ()->successMessage('Deleted Successfully'))->_selector('.xepan-communication-lister')->trigger('reload');
     }
     $this->on('click', '.do-view-delete-communication')->univ()->confirm('Are you sure?')->ajaxec(array($this->app->url(), 'do_delete_communication_id' => $this->js()->_selectorThis()->data('id')));
 }
Пример #16
0
 function init()
 {
     parent::init();
     $this->addClass('gridqsearch');
 }
Пример #17
0
 function init()
 {
     parent::init();
 }
Пример #18
0
 function init()
 {
     parent::init();
     // throw new \Exception($contact['name'], 1);
 }
Пример #19
0
 function init()
 {
     parent::init();
     $this->js('reload')->reload();
 }
Пример #20
0
 /**
  * Initialization
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->initWidget();
 }