当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::init方法代码示例

本文整理汇总了PHP中xepan\base\Page::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::init方法的具体用法?PHP Page::init怎么用?PHP Page::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xepan\base\Page的用法示例。


在下文中一共展示了Page::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 function init()
 {
     parent::init();
     $fy = $this->app->getFinancialYear();
     $from_date = $this->api->stickyGET('from_date') ?: $fy['start_date'];
     $to_date = $this->api->stickyGET('to_date') ?: $fy['end_date'];
     $f = $this->add('Form', null, null, ['form/stacked']);
     $c = $f->add('Columns')->addClass('row xepan-push');
     $l = $c->addColumn(6)->addClass('col-md-6');
     $r = $c->addColumn(6)->addClass('col-md-6');
     $l->addField('DatePicker', 'from_date')->set($from_date);
     $r->addField('DatePicker', 'to_date')->set($to_date);
     $f->addSubmit('Filter')->addClass('btn btn-primary btn-block');
     $view = $this->add('View', null, null, ['page/balancesheet']);
     if ($f->isSubmitted()) {
         return $view->js()->reload(['from_date' => $f['from_date'] ?: 0, 'to_date' => $f['to_date'] ?: 0])->execute();
     }
     $bsbalancesheet = $view->add('xepan\\accounts\\Model_BSBalanceSheet');
     $report = $bsbalancesheet->getTradingBalance($from_date, $to_date);
     $left = $report['left'];
     $right = $report['right'];
     $left_sum = $report['left_sum'];
     $right_sum = $report['right_sum'];
     $grid_l = $view->add('xepan\\hr\\Grid', null, 'balancesheet_liablity', ['view\\grid\\balancesheet']);
     $grid_l->setSource($left);
     $grid_l->template->trySet('lheading', 'Expenditure');
     $grid_a = $view->add('xepan\\hr\\Grid', null, 'balancesheet_assets', ['view\\grid\\balancesheet']);
     $grid_a->template->trySet('rheading', 'Income');
     $grid_a->setSource($right);
     $view->template->trySet('ltotal', $left_sum);
     $view->template->trySet('atotal', $right_sum);
     $view->js('click')->_selector('.xepan-accounts-bs-group.tradingrow')->univ()->frameURL('BalanceSheet Head Groups', [$this->api->url('xepan_accounts_bstogroup'), 'bs_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'from_date' => $from_date, 'to_date' => $to_date]);
 }
开发者ID:xepan,项目名称:accounts,代码行数:33,代码来源:trading.php

示例2: init

 function init()
 {
     parent::init();
     $this->app->side_menu->addItem(['Project Report', 'icon' => 'fa fa-sitemap'], 'xepan_projects_projectreport')->setAttr(['title' => 'Project Report']);
     $this->app->side_menu->addItem(['Project & Task Report', 'icon' => 'fa fa-tasks'], 'xepan_projects_projectandtaskreport')->setAttr(['title' => 'Project And Task Report']);
     $this->app->side_menu->addItem(['Task & Employee Report', 'icon' => 'fa fa-user'], 'xepan_projects_taskandemployeereport')->setAttr(['title' => 'Task And Employee Report']);
 }
开发者ID:xepan,项目名称:projects,代码行数:7,代码来源:reportsidebar.php

示例3: init

 function init()
 {
     parent::init();
     $employee_id = $this->app->stickyGET('employee_id');
     $m = $this->add('xepan\\hr\\Model_Employee_Movement');
     $m->addCondition('employee_id', $employee_id);
     $m->addCondition('movement_at', '>=', $this->app->today);
     $m->addCondition('movement_at', '<', $this->app->nextDate($this->app->today));
     $m->addExpression('next_movement_time')->set(function ($m, $q) {
         $next_movement = $this->add('xepan\\hr\\Model_Employee_Movement', ['table_alias' => 'next_movement'])->addCondition('employee_id', $m->getElement('employee_id'))->addCondition('movement_at', '>', $m->getElement('movement_at'))->addCondition('date', $m->getElement('date'))->setLimit(1);
         return $q->expr('IFNULL([0],CONCAT([1]," ",[2]))', [$next_movement->fieldQuery('movement_at'), $m->getElement('date'), $m->getElement('employee_out_time')]);
     });
     $m->addExpression('next_movement_direction')->set(function ($m, $q) {
         $next_movement = $this->add('xepan\\hr\\Model_Employee_Movement', ['table_alias' => 'next_movement'])->addCondition('employee_id', $m->getElement('employee_id'))->addCondition('movement_at', '>', $m->getElement('movement_at'))->addCondition('date', $m->getElement('date'))->setLimit(1);
         return $next_movement->fieldQuery('direction');
     });
     $m->addExpression('duration')->set(function ($m, $q) {
         return $q->expr('(TIMEDIFF([0],[1]))', [$m->getElement('next_movement_time'), $m->getElement('movement_at')]);
     });
     $grid = $this->add('xepan\\hr\\Grid', null, null, ['view\\employee\\movementdetail']);
     $grid->setModel($m);
     $grid->addPaginator(10);
     $grid->addQuickSearch(['direction']);
     $employee = $this->add('xepan\\hr\\Model_Employee')->load($employee_id);
     $grid->template->trySet('employee_name', $employee['name']);
     $grid->addColumn('Duration');
     $grid->addMethod('format_timeduration', function ($grid, $field) {
         $grid->current_row_html['duration'] = $grid->model['duration'];
     });
     $grid->addFormatter('Duration', 'timeduration');
 }
开发者ID:xepan,项目名称:hr,代码行数:31,代码来源:movementdetail.php

示例4: init

 function init()
 {
     parent::init();
     $department = $this->add('xepan\\hr\\Model_Department');
     $department->add('xepan\\hr\\Controller_SideBarStatusFilter');
     if ($status = $this->app->stickyGET('status')) {
         $department->addCondition('status', $status);
     }
     $department->setOrder('production_level', 'asc');
     $crud = $this->add('xepan\\hr\\CRUD', null, null, ['view/department/department-grid']);
     $crud->grid->addPaginator(50);
     if (!$crud->isEditing()) {
         $crud->grid->template->trySet('dept-url', $this->app->url('xepan_hr_structurechart'));
     }
     $crud->setModel($department);
     $crud->add('xepan\\base\\Controller_MultiDelete');
     if ($crud->form->model['is_system']) {
         $crud->form->getElement('production_level')->destroy();
     }
     $crud->grid->addHook('formatRow', function ($g) {
         if ($g->model['is_system']) {
             $g->current_row_html['edit'] = '<span class="fa-stack table-link"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span>';
             $g->current_row_html['delete'] = '<span class="table-link fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-trash-o fa-stack-1x fa-inverse"></i></span>';
             $g->current_row_html['action'] = '';
         }
     });
     $f = $crud->grid->addQuickSearch(['name']);
     if (!$crud->isEditing()) {
         $crud->grid->js('click')->_selector('.do-view-department-post')->univ()->frameURL('Department Post', [$this->api->url('xepan_hr_post'), 'department_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]);
         $crud->grid->js('click')->_selector('.do-view-department-employee')->univ()->frameURL('Department Employee', [$this->api->url('xepan_hr_employee'), 'department_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'status' => '']);
     }
 }
开发者ID:xepan,项目名称:hr,代码行数:32,代码来源:department.php

示例5: init

 function init()
 {
     parent::init();
     $m = $this->add('xepan/marketing/Model_Content');
     $m->load($_GET['content_id']);
     $this->add('View')->setHtml($m['message_blog']);
 }
开发者ID:xepan,项目名称:marketing,代码行数:7,代码来源:newsletterpreview.php

示例6: init

 function init()
 {
     parent::init();
     $department_id = $this->app->stickyGET('dept_id');
     $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance');
     $emp_j = $attendances->join('employee.contact_id', 'employee_id');
     $emp_j->addField('department_id');
     $attendances->addExpression('emp_status')->set(function ($m, $q) {
         $emp = $this->add('xepan\\hr\\Model_Employee');
         $emp->addCondition('id', $m->getElement('employee_id'));
         $emp->setLimit(1);
         return $emp->fieldQuery('status');
     });
     $attendances->addExpression('department_name')->set(function ($m, $q) {
         $emp = $this->add('xepan\\hr\\Model_Department');
         $emp->addCondition('id', $m->getElement('department_id'));
         $emp->setLimit(1);
         return $emp->fieldQuery('name');
     });
     $attendances->addCondition('emp_status', 'Active');
     $attendances->addCondition('department_id', $department_id);
     $attendances->addExpression('avg_late')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('late_coming')]));
     $attendances->addExpression('avg_extra_work')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('extra_work')]));
     $attendances->_dsql()->group('employee_id');
     $this->grid = $this->add('xepan\\hr\\Grid', null, null, ['page\\widget\\employeeperformance']);
     $this->grid->setModel($attendances, ['employee', 'avg_late', 'avg_extra_work']);
     $this->grid->addQuickSearch(['employee']);
     $this->grid->addPaginator(10);
     $this->grid->addFormatter('avg_late', 'gmdate');
     $this->grid->addFormatter('avg_extra_work', 'gmdate');
 }
开发者ID:xepan,项目名称:hr,代码行数:31,代码来源:employeeperformance.php

示例7: init

 function init()
 {
     parent::init();
     if (!$this->app->getConfig('developer_mode')) {
         throw $this->exception('Testing can conly be executed in develoepr mode');
     }
     if (!$this->auto_test) {
         $this->setVariance(array('test'));
         return;
         // used for multi-page testing
     }
     $this->grid = $this->add('Grid');
     $this->grid->addColumn('template', 'name')->setTemplate('<a href="' . $this->api->url(null, array('testonly' => '')) . '<?$name?>"><?$name?></a>');
     $this->setVariance(array('test'));
     //$this->setVariance(array('GiTemplate','SMlite'));
     $this->runTests();
     if (!$_GET['testonly']) {
         $f = $this->add('Form');
         $ff = $f->addField('Text', 'responses');
         $this->responses = '    public $proper_responses=array(
     ' . join(',
     ', $this->responses) . '
 );';
         $ff->set($this->responses);
         $ff->js('click')->select();
     }
 }
开发者ID:xepan,项目名称:base,代码行数:27,代码来源:Tester.php

示例8: init

 function init()
 {
     parent::init();
     // $emp->addCondition('status','Active');
     $emp = $this->add('xepan\\hr\\Model_Employee');
     $emp->addCondition('status', 'Active');
     $emp_nav = $this->add('xepan\\communication\\View_InternalMessageEmployeeList', null, 'message_navigation');
     $emp_nav->setModel($emp, ['name']);
     $emp_id = $this->app->stickyGET('employee_id');
     $msg_m = $this->add('xepan\\communication\\Model_Communication_AbstractMessage');
     $msg_m->addCondition([['from_raw', 'like', '%"' . $this->app->employee->id . '"%'], ['to_raw', 'like', '%"' . $this->app->employee->id . '"%']]);
     if ($emp_id) {
         $employee = $this->add('xepan\\hr\\Model_Employee');
         $employee->load($emp_id);
         $msg_m->addCondition([['from_raw', 'like', '%"' . $employee->id . '"%'], ['to_raw', 'like', '%"' . $employee->id . '"%']]);
     }
     // $msg_m->setOrder('id','desc');
     $msg_list = $this->add('xepan\\communication\\View_Lister_InternalMSGList', null, 'message_lister');
     $msg_list->setModel($msg_m);
     $msg_list->add('xepan\\base\\Controller_Avatar', ['options' => ['size' => 50, 'border' => ['width' => 0]], 'name_field' => 'contact']);
     $paginator = $msg_list->add('xepan\\base\\Paginator', ['ipp' => 10]);
     $paginator->setRowsPerPage(10);
     //trigger reload
     $msg_list->addClass('xepan-internal-message-trigger-reload');
     // $msg_list->js('reload')->reload();
     $compose_msg = $this->add('xepan\\communication\\View_ComposeMessagePopup', ['employee_id' => $emp_id], 'message_compose_view');
     $emp_nav->js('click', [$compose_msg->js()->html(' ')->reload(['employee_id' => $this->js()->_selectorThis()->data('id')]), $msg_list->js()->html('<div style="width:100%"><img style="width:20%;display:block;margin:auto;" src="vendor\\xepan\\communication\\templates\\images\\email-loader.gif"/></div>')->reload(['employee_id' => $this->js()->_selectorThis()->data('id')])])->_selector('.internal-conversion-emp-list');
 }
开发者ID:xepan,项目名称:communication,代码行数:28,代码来源:internalmsg.php

示例9: init

 function init()
 {
     parent::init();
     $action = $this->api->stickyGET('action') ?: 'view';
     $purchase_inv_dtl = $this->add('xepan\\commerce\\Model_PurchaseInvoice')->tryLoadBy('id', $this->api->stickyGET('document_id'));
     $view_field = ['contact_id', 'document_no', 'type', 'billing_address', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_city', 'shipping_pincode', 'gross_amount', 'discount_amount', 'net_amount', 'delivery_date', 'tnc_text', 'narration', 'exchange_rate', 'currency'];
     $form_field = ['contact_id', 'document_no', 'created_at', 'due_date', 'billing_address', 'billing_country_id', 'billing_state_id', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_country_id', 'shipping_state_id', 'shipping_city', 'shipping_pincode', 'discount_amount', 'narration', 'exchange_rate', 'currency_id', 'tnc_id'];
     $dv = $this->add('xepan\\commerce\\View_QSPAddressJS')->set('');
     $view = $this->add('xepan\\commerce\\View_QSP', ['qsp_model' => $purchase_inv_dtl, 'qsp_view_field' => $view_field, 'qsp_form_field' => $form_field]);
     $view->js(true)->_selector('#shipping-hide')->hide();
     $view->js('click')->_selector('a.new-qsp')->univ()->location($this->app->url(null, ['action' => 'add', 'document_id' => false]));
     if ($action != 'view') {
         $contact_field = $view->document->form->getElement('contact_id');
         $contact_field->model->addCondition('type', 'Supplier');
         $contact_field->js('change', $dv->js()->reload(['changed_contact_id' => $contact_field->js()->val()]));
     }
     if ($action == 'edit' && !$view->document_item->isEditing()) {
         $view->app->addHook('post-submit', function ($f) use($purchase_inv_dtl) {
             if ($_POST) {
                 $purchase_inv_dtl->addHook('afterSave', function ($m) {
                     $m->updateTransaction();
                 });
             }
         });
         $m = $view->document_item->model;
         $m->addHook('afterSave', function ($m) {
             $m->purchaseInvoice()->updateTransaction();
         });
     }
 }
开发者ID:xepan,项目名称:commerce,代码行数:30,代码来源:purchaseinvoicedetail.php

示例10: init

 function init()
 {
     parent::init();
     $task = $this->add('xepan\\projects\\Model_Task');
     $task->addCondition($task->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where('created_by_id', $this->app->employee->id));
     $task->addCondition('status', 'not in', ['Assigned', 'Completed']);
     $form = $this->add('Form')->addClass('main-box');
     $col = $form->add('Columns');
     $col1 = $col->addColumn(6)->addClass('col-md-6')->setStyle('height', '80px');
     $col2 = $col->addColumn(3)->addClass('col-md-3')->setStyle('height', '80px');
     $col3 = $col->addColumn(3)->addClass('col-md-3')->setStyle('height', '80px');
     $task_field = $col1->addField('xepan\\base\\DropDown', 'task');
     $task_field->setEmptyText('Please select a task or add new by typing');
     $task_field->setModel($task);
     $task_field->validate_values = false;
     $task_field->select_menu_options = ['tags' => true];
     $starttime_field = $col2->addField('TimePicker', 'starttime');
     $endtime_field = $col3->addField('TimePicker', 'endtime');
     $starttime_field->setOption('showMeridian', false)->setOption('minuteStep', 1)->setOption('showSeconds', true);
     $endtime_field->setOption('showMeridian', false)->setOption('minuteStep', 1)->setOption('showSeconds', true);
     $form->addSubmit('Save')->addClass('btn btn-primary')->setStyle('text-align', 'center');
     $timesheet_m = $this->add('xepan\\projects\\Model_Timesheet');
     $timesheet_m->addCondition('employee_id', $this->app->employee->id);
     $timesheet_m->addCondition('starttime', '>=', $this->app->today);
     $timesheet_m->acl = 'xepan\\projects\\Model_Task';
     $timesheet_m->setOrder('starttime', 'asc');
     $grid = $this->add('xepan\\hr\\CRUD');
     $grid->setModel($timesheet_m, ['task', 'starttime', 'endtime', 'duration']);
     $grid->grid->removeColumn('action');
     $grid->grid->removeColumn('attachment_icon');
     if ($form->isSubmitted()) {
         $timestamp = $this->app->today;
         $timestamp .= ' ' . $form['starttime'];
         $starting_time = date('Y-m-d H:i:s', strtotime($timestamp));
         $timestamp = $this->app->today;
         $timestamp .= ' ' . $form['endtime'];
         $ending_time = date('Y-m-d H:i:s', strtotime($timestamp));
         $model_task = $this->add('xepan\\projects\\Model_Task');
         $model_task->addCondition($model_task->dsql()->orExpr()->where('assign_to_id', $this->app->employee->id)->where('created_by_id', $this->app->employee->id));
         $model_task->tryLoadBy('id', $form['task']);
         if (!$model_task->loaded()) {
             if (!$form['task']) {
                 $form->displayError('task', 'Add a new task or select from old');
             }
             $model_task['task_name'] = $form['task'];
             $model_task['assign_to_id'] = $this->app->employee->id;
             $model_task['created_by_id'] = $this->app->employee->id;
             $model_task['status'] = 'Pending';
             $model_task['created_at'] = $this->app->now;
             $model_task->save();
         }
         $model_timesheet = $this->add('xepan\\projects\\Model_Timesheet');
         $model_timesheet['employee_id'] = $this->app->employee->id;
         $model_timesheet['task_id'] = $model_task->id;
         $model_timesheet['starttime'] = $starting_time;
         $model_timesheet['endtime'] = $ending_time;
         $model_timesheet->save();
         $form->js('true', $grid->js()->reload())->univ()->successMessage('Saved')->execute();
     }
 }
开发者ID:xepan,项目名称:projects,代码行数:60,代码来源:todaytimesheet.php

示例11: init

 function init()
 {
     parent::init();
     $tabs = $this->add('Tabs');
     $permitted_dashboards = $tabs->addTab('Permitted Dashboards');
     $default_permitted_list = [];
     switch ($this->app->employee->ref('post_id')->get('permission_level')) {
         case 'Global':
             $default_permitted_list = ['Global', 'Sibling', 'Department', 'Individual'];
             break;
         case 'Sibling':
             $default_permitted_list = ['Sibling', 'Department', 'Individual'];
             break;
         case 'Department':
             $default_permitted_list = ['Department', 'Individual'];
             break;
         default:
             $default_permitted_list = ['Individual'];
     }
     $permitted_reports_model = $this->add('xepan\\base\\Model_GraphicalReport');
     $permitted_reports_model->addCondition([['name', 'in', $default_permitted_list], ['permitted_post', 'like', '%"' . $this->app->employee['post_id'] . '"%'], ['created_by_id', $this->app->employee->id]]);
     $form = $permitted_dashboards->add('Form');
     $form->addField('DropDown', 'permitted_dashboards')->setModel($permitted_reports_model);
     $form->addSubmit('Save')->addClass('btn btn-primary');
     if ($form->isSubmitted()) {
         $employee_m = $this->add('xepan\\hr\\Model_Employee');
         $employee_m->load($this->app->employee->id);
         $employee_m['graphical_report_id'] = $form[''];
     }
 }
开发者ID:xepan,项目名称:hr,代码行数:30,代码来源:setting.php

示例12: init

 function init()
 {
     parent::init();
     $action = $this->api->stickyGET('action') ?: 'view';
     $document_id = $this->app->stickyGET('document_id');
     $sale_odr_dtl = $this->add('xepan\\commerce\\Model_SalesOrder')->tryLoadBy('id', $this->api->stickyGET('document_id'));
     $view_field = ['contact_id', 'document_no', 'type', 'billing_address', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_city', 'shipping_pincode', 'gross_amount', 'discount_amount', 'net_amount', 'delivery_date', 'tnc_text', 'narration', 'exchange_rate', 'currency'];
     $form_field = ['contact_id', 'document_no', 'created_at', 'due_date', 'billing_address', 'billing_country_id', 'billing_state_id', 'billing_city', 'billing_pincode', 'shipping_address', 'shipping_country_id', 'shipping_state_id', 'shipping_city', 'shipping_pincode', 'discount_amount', 'narration', 'exchange_rate', 'currency_id', 'tnc_id'];
     $dv = $this->add('xepan\\commerce\\View_QSPAddressJS')->set('');
     $view = $this->add('xepan\\commerce\\View_QSP', ['qsp_model' => $sale_odr_dtl, 'qsp_view_field' => $view_field, 'qsp_form_field' => $form_field]);
     $consumable_view = $this->add('xepan\\commerce\\View_StockAvailibility', ['sale_order_id' => $sale_odr_dtl->id]);
     if ($document_id) {
         $consumable_view->setModel($sale_odr_dtl->orderItems());
     }
     // $view->document->effective_template->setHTML('consumable_item_view',$consumable_view->getHtml());
     $view->document_item->js('reload', $consumable_view->js()->reload(null, null, [$this->app->url(null, ['cut_object' => $consumable_view->name])]));
     $view->js('click')->_selector('a.new-qsp')->univ()->location($this->app->url(null, ['action' => 'add', 'document_id' => false]));
     $vp = $this->add('VirtualPage');
     $vp->set(function ($p) {
         $order_id = $p->app->stickyGET('order_id');
         $attachments = $p->add('xepan\\commerce\\Model_QSP_DetailAttachment');
         $attachments->addCondition('qsp_detail_id', $order_id);
         $grid = $p->add('xepan\\base\\Grid', null, null, ['view\\qsp\\attachments']);
         $grid->setModel($attachments);
     });
     $view->on('click', '.order-export-attachments', function ($js, $data) use($vp) {
         return $js->univ()->dialogURL("EXPORT ATTACHMENTS", $this->api->url($vp->getURL(), ['order_id' => $data['id']]));
     });
     if ($action != 'view') {
         $contact_field = $view->document->form->getElement('contact_id');
         $contact_field->model->addCondition('type', 'Customer');
         $contact_field->js('change', $dv->js()->reload(['changed_contact_id' => $contact_field->js()->val()]));
     }
 }
开发者ID:xepan,项目名称:commerce,代码行数:34,代码来源:salesorderdetail.php

示例13: init

 function init()
 {
     parent::init();
     $attendances = $this->add('xepan\\hr\\Model_Employee_Attandance');
     $emp_j = $attendances->join('employee.contact_id', 'employee_id');
     $emp_j->addField('department_id');
     $attendances->addExpression('emp_status')->set(function ($m, $q) {
         $emp = $this->add('xepan\\hr\\Model_Employee');
         $emp->addCondition('id', $m->getElement('employee_id'));
         $emp->setLimit(1);
         return $emp->fieldQuery('status');
     });
     $attendances->addExpression('department_name')->set(function ($m, $q) {
         $emp = $this->add('xepan\\hr\\Model_Department');
         $emp->addCondition('id', $m->getElement('department_id'));
         $emp->setLimit(1);
         return $emp->fieldQuery('name');
     });
     $attendances->addCondition('emp_status', 'Active');
     $attendances->addExpression('avg_late')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('late_coming')]));
     $attendances->addExpression('avg_extra_work')->set($attendances->dsql()->expr('AVG([0])/60', [$attendances->getElement('extra_work')]));
     $attendances->_dsql()->group('department_id');
     $this->grid = $this->add('xepan\\hr\\Grid', null, null, ['page\\widget\\averageperformance']);
     $this->grid->setModel($attendances, ['department_name', 'department_id', 'avg_late', 'avg_extra_work']);
     $this->grid->addQuickSearch(['department_name']);
     $this->grid->addPaginator(10);
     $this->grid->addFormatter('avg_late', 'gmdate');
     $this->grid->addFormatter('avg_extra_work', 'gmdate');
     $this->grid->js('click')->_selector('.average-performance-digging')->univ()->frameURL('Employee Average Performance', [$this->api->url('xepan_hr_widget_employeeperformance'), 'dept_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')]);
 }
开发者ID:xepan,项目名称:hr,代码行数:30,代码来源:averageperformance.php

示例14: init

 function init()
 {
     parent::init();
     $this->js(true)->_load('masonry.pkgd.min')->masonry(['itemSelector' => '.widget'])->_selector('.widget-grid');
     $this->app->hook('widget_collection', [&$this->widget_list]);
     $this->app->hook('entity_collection', [&$this->entity_list]);
     $report_id = $this->api->stickyGET('report_id');
     foreach ($_GET as $get => $value) {
         if ($value and !in_array($get, ['page', 'cut_object', 'cut_page'])) {
             $this->api->stickyGET($get);
             $this->{$get} = $value;
         }
     }
     $this->filter_form = $this->add('Form', null, 'filter_form');
     $rpt = $this->add('xepan\\base\\Model_GraphicalReport')->load($report_id);
     $this->title = $rpt['name'];
     $report_w = $rpt->ref('xepan\\base\\GraphicalReport_Widget')->addCondition('is_active', true)->setOrder('order', 'asc');
     foreach ($report_w as $widget) {
         $w = $this->add('xepan\\base\\Widget_Wrapper');
         $w->addClass('widget');
         $w->addClass('col-md-' . $widget['col_width']);
         $widget = $w->add($widget['class_path'], ['report' => $this]);
         $widget->setFilterForm($this->filter_form);
     }
     $this->filter_form->addSubmit('Filter');
     if ($this->filter_form->isSubmitted()) {
         $form_result = $this->filter_form->get();
         if ($this->filter_form->hasElement('date_range')) {
             $form_result['start_date'] = $this->filter_form->getElement('date_range')->getStartDate();
             $form_result['end_date'] = $this->filter_form->getElement('date_range')->getEndDate();
         }
         $this->js()->reload($form_result)->execute();
     }
 }
开发者ID:xepan,项目名称:hr,代码行数:34,代码来源:runner.php

示例15: init

 function init()
 {
     parent::init();
     $bs_id = $this->api->stickyGET('bs_id');
     $from_date = $this->api->stickyGET('from_date');
     $to_date = $this->api->stickyGET('to_date');
     $bs_group = $this->add('xepan\\accounts\\Model_BSGroup', ['from_date' => $from_date, 'to_date' => $to_date]);
     $bs_group->addCondition('balance_sheet_id', $bs_id);
     $bs_group->addCondition('parent_group_id', null);
     $grid = $this->add('xepan\\hr\\Grid', null, null, ['view\\grid\\bstogroup']);
     $grid->setModel($bs_group);
     $grid->addColumn('balance');
     $grid->addMethod('format_balance', function ($g, $f) {
         $side = $g->model['ClosingBalanceDr'] > $this->model['ClosingBalanceCr'] ? "Dr" : "Cr";
         $amount = abs($g->model['ClosingBalanceDr'] - $g->model['ClosingBalanceCr']);
         if ($amount) {
             $g->current_row_html[$f] = '<span style="float:right">' . $side . '</span> ' . $amount;
         } else {
             $g->current_row_html[$f] = '';
         }
     });
     $grid->addFormatter('balance', 'balance');
     $bs = $this->add('xepan\\accounts\\Model_BSBalanceSheet')->load($bs_id);
     $grid->template->trySet('head', $bs['name']);
     $grid->template->trySet('from_date', $from_date);
     $grid->template->trySet('to_date', $to_date);
     $grid->addTotals(['ClosingBalanceDr', 'ClosingBalanceCr', 'balance']);
     $this->js('click')->_selector('.xepan-accounts-bs-subgroup')->univ()->frameURL('Groups And Ledger', [$this->api->url('xepan_accounts_groupdig'), 'group_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id'), 'from_date' => $from_date, 'to_date' => $to_date]);
 }
开发者ID:xepan,项目名称:accounts,代码行数:29,代码来源:bstogroup.php


注:本文中的xepan\base\Page::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。