作者:xepa
项目:communicatio
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');
}
作者:xepa
项目:commerc
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()]));
}
}
作者:xepa
项目:marketin
function init()
{
parent::init();
$this->app->side_menu->addItem(['Social Configuration', 'icon' => 'fa fa-globe'], 'xepan_marketing_socialconfiguration')->setAttr(['title' => 'Social Configuration']);
$this->app->side_menu->addItem(['Lead Source', 'icon' => 'fa fa-user'], 'xepan_marketing_leadsource')->setAttr(['title' => 'Lead Source']);
$this->app->side_menu->addItem(['External Configuration', 'icon' => 'fa fa-gears'], 'xepan_marketing_externalconfiguration')->setAttr(['title' => 'External Configuration']);
}
作者:xepa
项目:bas
function init()
{
parent::init();
$contact = $this->add('xepan\\base\\Model_Contact')->load($this->api->stickyGET('contact_id'));
$contact_view = $this->add('xepan\\base\\View_Contact');
$contact_view->setModel($contact);
}
作者:xepa
项目:account
function init()
{
parent::init();
$tra = $this->add('xepan\\accounts\\Model_Transaction')->load(17);
$this->form = $form = $this->add('xepan\\accounts\\Form_EntryRunner');
$form->setModel($tra);
}
作者:xepa
项目:marketin
function init()
{
parent::init();
$m = $this->add('xepan/marketing/Model_Content');
$m->load($_GET['content_id']);
$this->add('View')->setHtml($m['message_blog']);
}
作者:xepa
项目:productio
function init()
{
parent::init();
$config_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['subject' => 'Line', 'body' => 'xepan\\base\\RichText', 'master' => 'xepan\\base\\RichText'], 'config_key' => 'PRODUCTION_JOBCARD_SYSTEM_CONFIG', 'application' => 'production']);
$config_m->add('xepan\\hr\\Controller_ACL');
$config_m->tryLoadAny();
$form = $this->add('Form', null, 'jobcard-received');
$form->setModel($config_m, ['subject', 'body', 'master']);
$form->getElement('subject')->set($config_m['subject'])->setFieldHint(' ')->setCaption('Subject');
$form->getElement('body')->set($config_m['body'])->setFieldHint(' ')->setCaption('Message');
$form->getElement('master')->set($config_m['master'])->setFieldHint('{$status},{$next_department},{$id},{$order_no},{$created_at},{$order_created_at},{$due_date},{$order_item},{$extra_info},{$order_item_quantity},{$extra_notes}')->setCaption('Master');
$save = $form->addSubmit('Save')->addClass('btn btn-primary');
$reset = $form->addSubmit('Reset')->addClass('btn btn-primary');
if ($form->isSubmitted()) {
if ($form->isClicked($save)) {
$form->save();
$form->js(null, $form->js()->reload())->univ()->successMessage('Information Updated')->execute();
}
if ($form->isClicked($reset)) {
$temp = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-subject.html"));
$temp1 = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-body.html"));
$temp2 = file_get_contents(realpath("../vendor/xepan/production/templates/default/jobcard-received-print.html"));
$config_m['subject'] = $temp;
$config_m['body'] = $temp1;
$config_m['master'] = $temp2;
$config_m->save();
$form->js(null, $form->js()->reload())->univ()->successMessage('Information Resetted')->execute();
}
}
}
作者:xepa
项目:cr
function init()
{
parent::init();
$emp_emails = $this->app->employee->getAllowSupportEmail();
$email_setting = $this->add('xepan\\communication\\Model_Communication_EmailSetting');
$email_setting->addCondition('is_active', true);
$email_setting->addCondition('id', $emp_emails);
$allow_email = [];
foreach ($emp_emails as $email) {
$allow_email[] = $email;
}
// var_dump($allow_email);
$st = $this->add('xepan\\crm\\Model_SupportTicket');
$st->addCondition('to_id', array_merge([0], $allow_email));
$st->addCondition('status', '<>', 'Draft');
$icon_array = $this->app->status_icon;
$model_class = get_class($st);
// throw new \Exception($model_class, 1);
unset($st->status[0]);
$counts = $st->_dsql()->del('fields')->field('status')->field('count(*) counts')->group('Status')->get();
$counts_redefined = [];
$total = 0;
foreach ($counts as $cnt) {
$counts_redefined[$cnt['status']] = $cnt['counts'];
$total += $cnt['counts'];
}
if ($this->add_all) {
$this->app->side_menu->addItem(['All', 'icon' => $icon_array[$model_class]['All'], 'badge' => [$total, 'swatch' => ' label label-primary label-circle pull-right']], $this->api->url(null, ['status' => null]), ['status'])->setAttr(['title' => 'All']);
}
foreach ($st->status as $s) {
// echo $s."</br>";
$this->app->side_menu->addItem([$s, 'icon' => $icon_array[$model_class][$s], 'badge' => [$counts_redefined[$s], 'swatch' => ' label label-primary label-circle pull-right']], $this->api->url(null, ['status' => $s]), ['status'])->setAttr(['title' => $s]);
}
}
作者:xepa
项目:h
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' => '']);
}
}
作者:xepa
项目:h
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');
}
作者:xepa
项目:h
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')]);
}
作者:xepa
项目:commerc
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();
});
}
}
作者:xepa
项目:project
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();
}
}
作者:xepa
项目:h
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[''];
}
}
作者:xepa
项目:h
function render()
{
// $this->js(true)->_load('masonry.pkgd.min')->masonry(['itemSelector'=>'.widget'])->_selector('.widget-grid');
$this->app->js('chart_rendered', 'console.log(123)');
//->masonry(['itemSelector'=>'.widget'])->_selector('.widget-grid');
return parent::render();
}
作者:xepa
项目:account
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]);
}
作者:xepa
项目:bas
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();
}
}
作者:xepa
项目:marketin
function init()
{
parent::init();
$post_id = $this->app->stickyGET('post_id');
$social = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting');
$social->addCondition('post_id', $post_id);
$social->tryLoadAny();
$grid = $this->add('xepan\\hr\\Grid', null, 'grid', ['grid/total-posting-grid']);
$grid->setModel($social);
$grid->add('xepan\\hr\\Controller_ACL');
$model_post = $this->add('xepan\\marketing\\Model_SocialPost')->load($post_id);
$grid->template->trySet('post_title', $model_post['title']);
$grid->template->trySetHtml('post_content', $model_post['message_blog']);
$grid->template->trySet('post_url', $model_post['url']);
$grid->addHook('formatRow', function ($g) {
$g->current_row['monitoring'] = $g->model['is_monitoring'];
$g->current_row['forcemonitoring'] = $g->model['force_monitor'];
});
$comment_view = $this->add('xepan\\marketing\\View_PostComments', null, 'view', ['view\\postcomments']);
$comment_view_url = $this->api->url(null, ['cut_object' => $comment_view->name]);
$grid->js('click', $comment_view->js()->reload(['posting_id' => $this->js()->_selectorThis()->closest('[data-id]')->data('id')], null, $comment_view_url))->_selector('.post-comments');
$grid->on('click', '.update-activity-button', function ($js, $data) use($grid, $post_id) {
$model_post = $this->add('xepan\\marketing\\Model_SocialPost')->load($post_id);
if (!$model_post->loaded()) {
throw new \Exception("No posts to update");
}
$model_post->updateActivity();
return $this->js()->univ()->successMessage('Updated');
});
}
作者:xepa
项目:communicatio
function render()
{
$this->js(true)->_load('wizard')->_Selector('.wizard')->wizard();
$this->js('finished', $this->form->js()->submit())->_selector('.wizard');
$this->app->jui->addStylesheet('compiled/wizard');
parent::render();
}
作者:xepa
项目:h
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');
}