Пример #1
0
 function setModel($model, $fields = null)
 {
     // $model->setOrder('name');
     parent::setModel($model, $fields);
     if ($this->model->count()->getOne() > 0) {
         $this->template->tryDel('no_record_found');
     }
     $paginator = $this->add('Paginator', null, 'paginator');
     $paginator->setRowsPerPage($rows = 3);
 }
Пример #2
0
 function setModel($model)
 {
     $m = parent::setModel($model);
     $post = $this->add('xepan\\blog\\Model_BlogPost')->load($m['blog_post_id']);
     if ($post['show_comments'] === 'hide') {
         $this->template->del('comment_wrapper');
         $this->template->trySet('msg', 'Comments are closed for this post');
     } else {
         if ($post['anonymous_comment_config'] === 'none' && $post['registered_comment_config'] === 'none') {
             return $m;
         }
     }
     $sub_form = $this->add('Form', null, 'comment_form_' . $this->options['comment_form_position']);
     $comment_field = $sub_form->addField('text', 'Comment')->validate('required');
     $sub_form->addSubmit('Submit')->addClass('btn btn-primary btn-lg');
     if ($this->app->recall('comment')) {
         $comment_field->set($this->app->recall('comment'));
         $this->app->forget('comment');
     }
     if ($sub_form->isSubmitted()) {
         if ($this->options['allow_anonymous_comment'] === false || $post['anonymous_comment_config'] === 'none') {
             $contact = $this->add('xepan\\base\\Model_Contact');
             if ($contact->loadLoggedIn()) {
                 $comment_model = $this->add('xepan\\blog\\Model_Comment');
                 $comment_model['comment'] = $sub_form['Comment'];
                 $comment_model['blog_post_id'] = $m['blog_post_id'];
                 $comment_model['created_by_id'] = $contact->id;
                 $comment_model['status'] = $post['registered_comment_config'] == 'moderate' ? 'Pending' : 'Approved';
                 $comment_model->save();
                 if ($comment_model['status'] === 'Pending') {
                     $msg_string = "Your message has been sent for approval";
                 } else {
                     $msg_string = "Done";
                 }
                 $sub_form->js(null, $this->js()->reload())->univ()->successMessage($msg_string)->execute();
             } else {
                 $this->api->memorize('comment', $sub_form['Comment']);
                 $this->api->memorize('next_url', array('page' => $_GET['page'], 'post_id' => $_GET['post_id']));
                 $this->app->redirect($this->options['login_page']);
             }
         }
         $comment_model = $this->add('xepan\\blog\\Model_Comment');
         $comment_model['comment'] = $sub_form['Comment'];
         $comment_model['blog_post_id'] = $m['blog_post_id'];
         $comment_model['status'] = $post['anonymous_comment_config'] == 'moderate' ? 'Pending' : 'Approved';
         $comment_model->save();
         if ($comment_model['status'] === 'Pending') {
             $msg_string = "Your message has been sent for approval";
         } else {
             $msg_string = "Done";
         }
         $sub_form->js(null, $this->js()->reload())->univ()->successMessage($msg_string)->execute();
     }
     return $m;
 }
Пример #3
0
 function setModel($model, $fields = null)
 {
     // $model->setOrder('name');
     parent::setModel($model, $fields);
     if ($this->model->count()->getOne() > 0) {
         $this->template->tryDel('no_record_found');
     }
     if (!$this->loadmore) {
         $this->template->tryDel('loadmore');
     }
 }
Пример #4
0
 function setModel($model)
 {
     parent::setModel($model);
     if ($this->ledger_id and $this->from_date) {
         $opening_balance = $this->add('xepan\\accounts\\Model_Ledger')->load($this->ledger_id)->getOpeningBalance($this->from_date);
         $this->template->set('opening_balance_narration', 'Opening Balance');
         $this->template->set('opening_balance', $opening_balance['cr']);
     } else {
         $this->template->tryDel('opening_balance_section');
     }
 }
Пример #5
0
 function setModel($model)
 {
     $model->addExpression('total_meetings')->set(function ($m, $q) {
         return $m->refSQL('Students_Attendance')->sum('total_attendance');
     });
     $model->addExpression('students_in_class')->set(function ($m, $q) {
         return "((select count(*) from `student` st2 where `st2`.`session_id` = `student`.`session_id` and `st2`.`class_id` = `student`.`class_id` ))";
     });
     $model->addExpression('all_attendance')->set(function ($m, $q) {
         return $m->refSQL('Students_Attendance')->sum('present');
     });
     parent::setModel($model);
     $extrarows = 10 - $model->count()->getOne();
     for ($i = 1; $i <= $extrarows; $i++) {
         $this->add('View', null, 'ExtraRows', array('view/extrarows'));
     }
 }
Пример #6
0
 function setModel($model)
 {
     $m = parent::setModel($model);
     return $m;
 }
Пример #7
0
 function render()
 {
     $this->max_depth = count(parent::setModel($this->model)) - 1;
     return parent::render();
 }
Пример #8
0
 function setModel($m)
 {
     parent::setModel($m);
 }
Пример #9
0
 function setModel($model)
 {
     $contact = $this->add('xepan\\base\\Model_Contact')->load($this->contact_id);
     $this->template->trySet('contact', $contact['name'] . " Communications");
     parent::setModel($model);
 }