formatRow() public method

Format lister row.
public formatRow ( )
Exemplo n.º 1
0
 function formatRow()
 {
     //calculating url
     if ($this->model['custom_link']) {
         // if custom link contains http or https then redirect to that website
         $has_https = strpos($this->model['custom_link'], "https");
         $has_http = strpos($this->model['custom_link'], "http");
         if ($has_http === false or $has_https === false) {
             $url = $this->app->url($this->model['custom_link'], ['xsnb_category_id' => $this->model->id]);
         } else {
             $url = $this->model['custom_link'];
         }
         $this->current_row_html['url'] = $url;
     } else {
         $url = $this->app->url($this->options['url_page'], ['xsnb_category_id' => $this->model->id]);
         $this->current_row_html['url'] = $url;
     }
     $sub_cat = $this->add('xepan\\commerce\\Model_Category', ['name' => 'model_child_' . $this->model->id]);
     $sub_cat->addCondition('parent_category_id', $this->model->id);
     $sub_cat->addCondition('status', "Active");
     $sub_cat->setOrder('display_sequence', 'desc');
     if ($sub_cat->count()->getOne() > 0) {
         $sub_c = $this->add('xepan\\commerce\\View_CategoryLister', ['options' => $this->options], 'nested_category', ['view\\tool\\/' . $this->options['custom_template'], 'category_list']);
         $sub_c->setModel($sub_cat);
         $this->current_row_html['nested_category'] = $sub_c->getHTML();
     } else {
         $this->current_row_html['nested_category'] = "";
     }
     parent::formatRow();
 }
Exemplo n.º 2
0
 function formatRow()
 {
     if ($this->model['is_starred']) {
         $this->current_row['starred'] = 'starred';
     } else {
         $this->current_row['starred'] = '';
     }
     $einfo = $this->model['extra_info'];
     if (isset($einfo['seen_by']) and is_array($einfo['seen_by'])) {
         if (in_array($this->app->employee->id, $einfo['seen_by'])) {
             $this->current_row['unread'] = '';
         } else {
             $this->current_row['unread'] = 'unread';
         }
     }
     if (!$this->model['attachment_count']) {
         $this->current_row['check_attach'] = '';
     } else {
         $this->current_row_html['check_attach'] = '<a href="#" class="attachment"><i class="fa fa-paperclip"></i></a>';
     }
     if ($this->model['status'] == "Draft") {
         $this->current_row['draft'] = 'draft-message';
     }
     $mailbox = explode('#', $this->model['mailbox']);
     $email_model = $this->add('xepan\\communication\\Model_Communication_EmailSetting');
     $email_model->tryLoadBy('email_username', $mailbox);
     $this->current_row['body'] = strip_tags($this->current_row['body']);
     if ($this->model['status'] == 'Sent') {
         $this->current_row['email_name'] = $email_model['name'] . " / " . $this->model['status'];
     } else {
         $this->current_row['email_name'] = $email_model['name'];
     }
     parent::formatRow();
 }
Exemplo n.º 3
0
 function formatRow()
 {
     $this->current_row_html['labels'] = ($this->model['is_debug'] ? '<span class="atk-label atk-effect-info">DEBUG</span>' : '') . ($this->model['is_prefered'] ? '<span class="atk-label atk-effect-info">Preferred</span>' : '') . ($this->model['is_scrap'] ? '<span class="atk-label atk-effect-danger">Scrap</span>' : '');
     $this->current_row_html['link'] = $this->app->url('dam/hosts/details', ['host_id' => $this->model->id]);
     $this->current_row_html['key-link'] = $this->app->url('dam/hosts/access', ['host_id' => $this->model->id]);
     //$b=$this->owner->add('Button')->set('Ping');
     //this->current_row_html['buttons']=$b->getHTML();
     return parent::formatRow();
 }
Exemplo n.º 4
0
 function formatRow()
 {
     $this->current_row_html['collapse_header'] = strip_tags($this->model['description']);
     $this->current_row_html['body'] = $this->model['description'];
     $attach = $this->add('xepan\\communication\\View_Lister_Attachment', null, 'attachments');
     $attach->setModel('xepan\\communication\\Communication_Attachment')->addCondition('communication_id', $this->model['communication_id']);
     $this->current_row_html['attachments'] = $attach->getHtml();
     parent::formatRow();
 }
 function formatRow()
 {
     if ($this->model['check_login'] != '0') {
         $this->current_row_html['color'] = "#8bc34a";
     } else {
         $this->current_row_html['color'] = "red";
     }
     parent::formatRow();
 }
Exemplo n.º 6
0
 function formatRow()
 {
     $amount = $this->model['amountDr'] - $this->model['amountCr'];
     if ($amount > 0) {
         $balance = $amount . " DR";
     } else {
         $balance = abs($amount) . " CR";
     }
     $this->current_row['s_no'] = $this->sno++;
     $this->current_row['created_date'] = date('Y-m-d', strtotime($this->model->get('created_at')));
     $this->current_row['balance'] = $balance;
     parent::formatRow();
 }
Exemplo n.º 7
0
 function formatRow()
 {
     parent::formatRow();
     $v = $this->add('View', 'search_' . $this->current_row['id'], 'name')->set($this->current_row['name']);
     if ($this->current_row['name'] == "clear") {
         $v->addClass('clear_filter');
     }
     $v->addStyle('cursor', 'pointer');
     if ($this->api->recall($this->owner->name . '_filter') == strtoupper($this->current_row['name'])) {
         $v->addClass('current');
     }
     $v->js('click', array($this->owner->grid->js()->reload(array($this->owner->name . '_filter' => $v->js()->text()))));
     $this->current_row_html['name'] = $v->getHTML();
 }
Exemplo n.º 8
0
 function formatRow()
 {
     $email = $this->add('xepan\\communication\\Model_Communication_Email_Received');
     $email->addCondition('direction', 'In');
     $email->addCondition('mailbox', $this->model['email_username'] . '#INBOX');
     $email_count = $email->count()->getOne();
     $unreademail = $this->add('xepan\\communication\\Model_Communication_Email_Received');
     $unreademail->addCondition('direction', 'In');
     $unreademail->addCondition('mailbox', $this->model['email_username'] . '#INBOX');
     $unreademail->addCondition('extra_info', 'not like', '%' . $this->app->employee->id . '%');
     $unread_email = $unreademail->count()->getOne();
     $this->current_row['email_count'] = $email_count;
     $this->current_row['unread_email'] = $unread_email;
     return parent::formatRow();
 }
Exemplo n.º 9
0
 function formatRow()
 {
     $jobcard = $this->add('xepan\\production\\Model_Jobcard');
     $jobcard->addCondition('order_item_id', $this->order_detail_id);
     $jobcard->addCondition('department_id', $this->model->id);
     $jobcard->tryLoadAny();
     $this->current_row_html['jobcard_no'] = $jobcard['id'];
     $this->current_row_html['status'] = $jobcard['status'];
     $this->current_row_html['created_at'] = $jobcard['created_at'];
     if ($jobcard->loaded()) {
         $this->current_row_html['active'] = "active";
     } else {
         $this->current_row_html['active'] = "deactive";
     }
     parent::formatRow();
 }
Exemplo n.º 10
0
 function formatRow()
 {
     $this->current_row_html['body'] = $this->model['description'];
     $to_mail = json_decode($this->model['to_raw'], true);
     $to_lister = $this->app->add('CompleteLister', null, null, ['view\\communication\\all-communication-viewer', 'to_lister']);
     $to_lister->setSource($to_mail);
     $cc_raw = json_decode($this->model['cc_raw'], true);
     $cc_lister = $this->app->add('CompleteLister', null, null, ['view\\communication\\all-communication-viewer', 'cc_lister']);
     $cc_lister->setSource($cc_raw);
     $from_mail = json_decode($this->model['from_raw'], true);
     $from_lister = $this->app->add('CompleteLister', null, null, ['view\\communication\\all-communication-viewer', 'from_lister']);
     $from_lister->setSource($from_mail);
     $this->current_row_html['from_lister'] = $from_lister->getHtml();
     $this->current_row_html['to_lister'] = $to_lister->getHtml();
     $this->current_row_html['cc_lister'] = $cc_lister->getHtml();
     return parent::formatRow();
 }
Exemplo n.º 11
0
 function formatRow()
 {
     parent::formatRow();
     $page = $this->model['page'];
     if (!$page && $this->max_depth) {
         // by default resort to parent pages
         $tmp = array();
         for ($i = 0; $i < $this->max_depth; $i++) {
             $tmp[] = '..';
         }
         $this->max_depth--;
         $page = $this->app->url(join('/', $tmp));
     }
     if ($page) {
         $this->current_row_html['crumb'] = '<a href="' . $this->app->url($page) . '">' . htmlspecialchars($this->model['name']) . '</a>';
     } else {
         $this->current_row_html['crumb'] = htmlspecialchars($this->model['name']);
     }
 }
Exemplo n.º 12
0
 function formatRow()
 {
     $attach = $this->add('xepan\\communication\\View_Lister_Attachment', null, 'Attachments');
     $attach->setModel('xepan\\communication\\Communication_Attachment')->addCondition('communication_id', $this->model->id);
     // $a = $this->add('xepan\communication\Model_Communication_Attachment')->addCondition('communication_id',$this->model->id);
     $this->current_row_html['Attachments'] = $attach->getHtml();
     $to_array = [];
     foreach ($this->model['to_raw'] as $to) {
         $to_array[] = $to['name'];
     }
     $this->current_row_html['to_name'] = implode(", ", $to_array);
     $this->current_row_html['from_name'] = $this->model['from_raw']['name'];
     if ($this->model['from_id'] === $this->app->employee->id) {
         $this->current_row_html['position'] = "left";
     } else {
         $this->current_row_html['position'] = "right";
     }
     // if($this->model['is_starred']){
     // 	$this->current_row['starred']='starred';
     // }else{
     // 	$this->current_row['starred']='';
     // }
     $einfo = $this->model['extra_info'];
     if (isset($einfo['seen_by']) and is_array($einfo['seen_by'])) {
         if (in_array($this->app->employee->id, $einfo['seen_by'])) {
             $this->current_row['unread'] = '';
         } else {
             $this->current_row['unread'] = 'unread';
         }
     }
     $this->current_row_html['message'] = $this->model['description'];
     if ($this->app->employee['scope'] != 'SuperUser') {
         $this->current_row_html['trash_wrapper'] = '';
     }
     parent::formatRow();
 }
Exemplo n.º 13
0
 function formatRow()
 {
     $this->current_row['notification'] = $this->model['notification'] ? $this->model['notification'] : $this->model['activity'];
     return parent::formatRow();
 }
Exemplo n.º 14
0
 /**
  * Format grid row
  *
  * Extends formatRow method of CompleteLister
  *
  * @return void
  */
 function formatRow()
 {
     // execute CompleteLister row formating
     parent::formatRow();
     if (!$this->columns) {
         throw $this->exception('No columns defined for grid');
     }
     foreach ($this->columns as $field => $column) {
         $this->current_row[$field . '_original'] = @$this->current_row[$field];
         // if model field has listData structure, then get value instead of key
         if ($this->model && ($f = $this->model->hasElement($field))) {
             if ($values = $f->listData()) {
                 $this->current_row[$field] = $values[$this->current_row[$field]];
             }
         }
         // process formatters
         $this->executeFormatters($field, $column, 'format_');
         // setting cell parameters (tdparam)
         $this->applyTDParams($field);
     }
 }
Exemplo n.º 15
0
 function formatRow()
 {
     parent::formatRow();
     $this->current_row['link'] = $this->api->url('./details', array('id' => $this->model->id));
     //$this->current_row['img_url'] = $this->model->ref('image_id')->get('url');
 }
Exemplo n.º 16
0
 function formatRow()
 {
     $to_mail = json_decode($this->model['to_raw'], true);
     $to_lister = $this->app->add('CompleteLister', null, null, ['view/communication1', 'to_lister']);
     $to_lister->setSource($to_mail);
     $cc_raw = json_decode($this->model['cc_raw'], true);
     $cc_lister = $this->app->add('CompleteLister', null, null, ['view/communication1', 'cc_lister']);
     $cc_lister->setSource($cc_raw);
     $from_mail = json_decode($this->model['from_raw'], true);
     $from_lister = $this->app->add('CompleteLister', null, null, ['view/communication1', 'from_lister']);
     $from_lister->setSource($from_mail);
     $attach = $this->app->add('CompleteLister', null, null, ['view/communication1', 'Attachments']);
     $attach->setModel('xepan\\communication\\Communication_Attachment')->addCondition('communication_id', $this->model->id);
     $this->current_row_html['description'] = $this->current_row['description'];
     if ($this->model['attachment_count']) {
         $this->current_row_html['attachment'] = '<span><i style="color:green" class="fa fa-paperclip"></i></span>';
     } else {
         $this->current_row_html['attachment'] = '';
     }
     $this->current_row_html['to_lister'] = $to_lister->getHtml();
     if ($this->model['communication_type'] === 'Email') {
         $this->current_row_html['cc_lister'] = $cc_lister->getHtml();
     } else {
         $this->current_row_html['cc_lister'] = "";
     }
     $this->current_row_html['from_lister'] = $from_lister->getHtml();
     $this->current_row_html['Attachments'] = $attach->getHtml();
     return parent::formatRow();
 }