function init() { parent::init(); $task_id = $this->task_id; $project_id = $this->project_id; $model_task = $this->add('xepan\\projects\\Model_Task'); $model_task->addExpression('contact_id')->set(function ($m, $q) { $comm = $this->add('xepan\\communication\\Model_Communication'); $comm->addCondition('id', $m->getElement('related_id')); $comm->setLimit(1); return $comm->fieldQuery('to_id'); }); $model_task->tryLoadBy('id', $task_id); if (!$model_task->loaded()) { return; } $tabs = $this->add('Tabs'); $tab1 = $tabs->addTab('Follow Up Task'); $tab2 = $tabs->addTab('Communicaion Details'); $task_view = $tab1->add('xepan\\projects\\View_Detail', ['task_id' => $task_id, 'project_id' => $project_id]); $communication_view = $tab2->add('xepan\\communication\\View_Lister_Communication', ['contact_id' => $model_task['contact_id']]); $model_communication = $this->add('xepan\\communication\\Model_Communication'); $model_communication->addCondition($model_communication->dsql()->andExpr()->where('to_id', $model_task['contact_id'])->where('to_id', '<>', null)); $model_communication->setOrder('id', 'desc'); $communication_view->setModel($model_communication); $communication_view->add('Paginator', ['ipp' => 10]); }
function init() { parent::init(); /*............. Currency Configuration ...............*/ if ($_GET[$this->name . '_account_config']) { $this->js(true)->univ()->frameURL("Currency Configuration", $this->app->url('xepan_accounts_config')); } $isDone = false; $action = $this->js()->reload([$this->name . '_account_config' => 1]); $default_currency = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['currency_id' => 'DropDown'], 'config_key' => 'FIRM_DEFAULT_CURRENCY_ID', 'application' => 'accounts']); $default_currency->tryLoadAny(); if ($default_currency['currency_id']) { $isDone = true; $action = $this->js()->univ()->dialogOK("Already have Data", ' You have already updated currency, visit page ? <a href="' . $this->app->url('xepan_accounts_config')->getURL() . '"> click here to go </a>'); } $default_currency_view = $this->add('xepan\\base\\View_Wizard_Step')->setAddOn('Application - Accounts')->setTitle('Set Currency')->setMessage('Please set currency configuration according to your country.')->setHelpMessage('Need help ! click on the help icon')->setHelpURL('#')->setAction('Click Here', $action, $isDone); /*............. Accounts Financial Year ...............*/ if ($_GET[$this->name . '_financial_year']) { $this->js(true)->univ()->frameURL("Financial Year Setting", $this->app->url('xepan_accounts_financialyear')); } $isDone = false; $action = $this->js()->reload([$this->name . '_financial_year' => 1]); $financial_year_mdl = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['default_financial_year_start_month' => 'DropDown', 'default_financial_year_end_month' => 'DropDown'], 'config_key' => 'DEFAULT_FINANCIAL_YEAR_AND_MONTH', 'application' => 'accounts']); $financial_year_mdl->tryLoadAny(); if ($financial_year_mdl['default_financial_year_start_month'] && $financial_year_mdl['default_financial_year_end_month']) { $isDone = true; $action = $this->js()->univ()->dialogOK("Already have Data", ' You have already updated financial year, visit page ? <a href="' . $this->app->url('xepan_accounts_financialyear')->getURL() . '"> click here to go </a>'); } $financial_year_view = $this->add('xepan\\base\\View_Wizard_Step')->setAddOn('Application - Accounts')->setTitle('Set Financial Year')->setMessage('Please configure financial year for your accounts reports.')->setHelpMessage('Need help ! click on the help icon')->setHelpURL('#')->setAction('Click Here', $action, $isDone); }
function init() { parent::init(); $component_list = ""; $installed_components = $this->add('Model_InstalledComponents'); $installed_components->addCondition('epan_id', $this->api->current_website->id); foreach ($installed_components as $junk) { $component_list .= '<li><a href="?page=' . $junk['namespace'] . '_page_owner_main"><i class="glyphicon glyphicon-play"></i> ' . $junk['name'] . '</a></li>'; } $this->template->trySetHTML('conponents_list', $component_list); $msg = $this->add("Model_Messages"); $msg->addCondition('epan_id', $this->api->current_website->id); //$msg->addCondition('is_read',false); $msg->_dsql()->having($msg->_dsql()->orExpr()->where('is_read', false)->where('watch', true)); $msg->tryLoadAny()->_dsql()->limit(3)->order('id', 'desc'); $alt = $this->add("Model_Alerts"); $alt->addCondition('epan_id', $this->api->current_website->id); $alt->addCondition('is_read', false); $alt->tryLoadAny()->_dsql()->limit(3)->order('id', 'desc'); $this->add('View_Message', null, 'message')->setModel($msg); $this->add('View_Alerts', null, 'alert')->setModel($alt); $total_messages = $this->api->current_website->ref('Messages')->count()->getOne(); $this->template->trySet('total_messages', $total_messages); $this->template->trySet('version', $this->api->getxEpanVersion()); }
function init() { parent::init(); $f = $this->add('Form', null, null, ['form/minimal']); $f->setLayout('view/tool/userpanel/form/login'); if ($message = $this->app->stickyGET('message')) { $f->layout->template->trySet('message', $message); } if (!$this->options['show_footer']) { $f->layout->template->del('footer_wrapper'); } $f->addField('Line', 'username', 'Email address'); $f->addField('Password', 'password', 'Password'); $auth = $this->app->auth; if ($f->isSubmitted()) { if (!($credential = $this->app->auth->verifyCredentials($f['username'], $f['password']))) { $f->displayError($f->getElement('password'), 'wrong credentials'); } $user = $this->add('xepan\\base\\Model_User')->load($credential); if ($user['status'] == 'Inactive') { $f->displayError('username', 'Please Activate Your Account First'); } $auth->login($f['username']); $this->app->hook('login_panel_user_loggedin', [$auth->model]); if ($next_url = $this->app->recall('next_url')) { $this->app->redirect($this->api->url($next_url))->execute(); } if ($success_url = $this->options['login_success_url']) { $this->app->redirect($this->app->url($success_url)); } } }
public function init() { parent::init(); if ($this->owner->swatch) { $this->addComponents(array('swatch' => $this->owner->swatch)); } }
function init() { parent::init(); $action = $this->api->stickyGET('action') ?: 'view'; $this->document = $document = $this->add('xepan\\base\\View_Document', ['action' => $action], null, ['view/qsp/master']); $document->setIdField('document_id'); $document->setModel($this->qsp_model, $this->qsp_view_field, $this->qsp_form_field); $document->form->getElement('discount_amount')->js('change')->_load('xepan-QSIP')->univ()->calculateQSIP(); if ($this->qsp_model->loaded()) { $this->document_item = $qsp_details = $document->addMany('Items', null, 'item_info', ['view/qsp/details'], 'xepan\\commerce\\Grid_QSP', 'xepan\\commerce\\CRUD_QSP'); $m = $this->qsp_model->ref('Details'); $qsp_details->setModel($m); $qs = $this->add('xepan\\commerce\\View_QSPDetailJS'); if (isset($qsp_details->form)) { $form = $qsp_details->form; $tax_field = $form->getElement('taxation_id'); $tax_percentage = $form->getElement('tax_percentage'); if ($id = $_GET['tax_id']) { $tax_percentage->set($this->add('xepan\\commerce\\Model_Taxation')->load($id)->get('percentage')); return; } $tax_field->js('change', $form->js()->atk4_form('reloadField', 'tax_percentage', [$this->app->url(), 'tax_id' => $tax_field->js()->val()])); } } }
function init() { parent::init(); $customer_model = $this->add('xepan\\commerce\\Model_CustomerCredit'); if (!$customer_model->loadLoggedIn()) { $this->add('View_Error', null, 'error')->set('you logout or session out try again'); return; } if ($this->customer_id and $customer_model->id != $this->customer_id) { $this->add('View_Error', null, 'error')->set('customer not found'); return; } if ($this->order['net_amount'] > $customer_model['remaining_credit_amount']) { $this->add('View_Error', null, 'error')->set('your have insufficient credit amount'); return; } else { $this->setModel($customer_model); $this->template->trySet('available_credit_amount', $customer_model['remaining_credit_amount']); $this->template->trySet('order_amount', $this->order['net_amount']); $form = $this->add('Form'); $form->addSubmit('Credit Pay Now'); if ($form->isSubmitted()) { $customer_model->consumeCredit($this->order['net_amount'], $this->order); $form->js()->univ()->redirect($this->app->url(null, array('step' => "Complete", 'paynow' => true, 'paid' => true, 'order_id' => $this->order->id)))->execute(); } } $this->add('Button', null, 'pay_via_online')->set('Continue with Online Payment')->js('click')->univ()->redirect($this->app->url(null, array('step' => "Payment", 'paynow' => true))); }
function init() { parent::init(); $this->information_grid = $this->add('Grid'); $this->gaurdian_grid = $this->add('Grid'); $this->form = $this->add('Form', NULL, NULL, array('form_horizontal')); $array = array('inward' => 'inward', 'outward' => 'outward', 'enquiry' => 'enquiry'); //, 'card outward'=>'Card Outward','self outward'=>'Self Outward','card inward'=>'Card Inward','self inward'=>'Self Inward' $this->form->addField('hidden', 'hosteler_id'); $drp_prps = $this->form->addField('dropdown', 'purpose', 'Action')->setEmptyText('----')->setNotNull(); $drp_prps->setValueList($array); $this->form->addField('line', 'remarks'); $sel = $this->form->addField('line', 'sel'); $sel->js(true)->closest('.atk-form-row')->hide(); $this->form->addSubmit('Save'); if ($this->form->isSubmitted()) { try { $form = $this->form; $form->api->db->beginTransaction(); $hm = $form->add('Model_Hosteler'); $hm->load($form->get('hosteler_id')); if ($hm['attendance_status'] == $form->get('purpose') and $form->get('purpose') != 'enquiry') { throw $form->exception("Already " . $form->get('purpose'))->setField('purpose'); } if ($form->get('purpose') == 'inward') { $hm['is_present'] = true; } if ($form->get('purpose') == 'outward') { $hm['is_present'] = false; } $hm->save(); $guardians = json_decode($form->get('sel')); if (count($guardians) == 0 and $form->get('remarks') == null) { $form->displayError('remarks', 'It is Must'); } $sm = $form->add('Model_Students_Movement'); $sm['student_id'] = $hm->id; $sm['gaurdian_id'] = $guardians[0]; $sm['remark'] = $form->get('remarks'); $sm['purpose'] = $form->get('purpose'); $sm['session_id'] = $this->add('Model_Sessions_Current')->tryLoadAny()->get('id'); if ($form->get('purpose') == 'enquiry' and trim($form->get('remarks')) == "") { throw $form->exception("Remark is must for enquiry")->setField('remarks'); } $sm->save(); // $roommodel= $sm->ref('student_id')->ref('RoomAllotement')->tryLoadAny()->ref('room_id'); // if($form->get('purpose') == 'inward') $roommodel['in_count'] = $roommodel['in_count'] +1; // if($form->get('purpose') == 'outward') $roommodel['in_count'] = $roommodel['in_count'] -1; // $roommodel->save(); } catch (Exception $e) { $form->api->db->rollback(); $form->js()->univ()->errorMessage($e->getMessage())->execute(); throw $e; } $form->api->db->commit(); $form->js(null, $this->js()->reload())->univ()->successMessage("Student Record Upadated success fully "); // $this->js()->univ()->newWindow($this->api->url('xShop_page_owner_printsaleinvoice',array('saleinvoice_id'=>$_GET['print'],'cut_page'=>0)))->execute(); $this->js()->univ()->newWindow($this->api->url('hostel_studentmovementprint', array('hosteler_id' => $form->get('hosteler_id'), 'purpose' => $this->form->get('purpose'), 'gaurdian' => implode(',', $guardians), 'building' => $hm->get('building_name'), 'room_no' => $hm->get('room_no'), 'remark' => $form->get('remarks'), 'date' => $sm->get('date'), 'cut_page' => 1)))->execute(); } }
function init() { parent::init(); $posting_id = $this->app->stickyGET('posting_id'); if (!$posting_id) { return; } $social_posting_model = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting')->load($posting_id); $model_posting_activity = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialActivity'); $model_posting_activity->addCondition('posting_id', $posting_id); $form = $this->add('Form', null, 'form'); $form->addField('text', 'comment')->validate('required')->addClass('xepan-push-small'); $form->addSubmit('Add')->addClass('btn btn-primary btn-block'); $comment_grid = $this->add('xepan\\hr\\grid', null, 'grid', ['grid\\social-comments']); $comment_grid->setModel($model_posting_activity); if ($form->isSubmitted()) { try { $social_posters = $this->add('xepan\\marketing\\SocialPosters_' . $social_posting_model['social_app']); $social_posters->comment($social_posting_model, $form['comment']); $form->js()->univ()->successMessage("commented")->execute(); } catch (Excepiton $e) { throw new \Exception($e); } } }
function init() { parent::init(); if ($_GET[$this->name . '_set_countries']) { $this->api->db->dsql()->expr(file_get_contents(realpath(getcwd() . '/vendor/xepan/base/countriesstates.sql')))->execute(); $this->js(true)->reload(); } $isDone = false; $action = $this->js()->reload([$this->name . '_set_countries' => 1]); if ($this->add('xepan\\base\\Model_Country')->count()->getOne() > 0) { $isDone = true; $action = $this->js()->univ()->dialogOK("Already have Data", ' You already have countries populated, visit page ? <a href="' . $this->app->url('xepan_communication_general_countrystate')->getURL() . '"> click here to go </a>'); } $country_view = $this->add('xepan\\base\\View_Wizard_Step'); $country_view->setAddOn('Application - Base')->setTitle('Country & State database not populated yet')->setMessage('Populate country and states.')->setHelpMessage('Need help ! click on the help icon')->setHelpURL('#')->setAction('Click Here', $action, $isDone); if ($_GET[$this->name . '_time_zone']) { $this->js(true)->univ()->frameURL("Time Zone", $this->app->url('xepan_communication_generalsetting')); } $isDone = false; $action = $this->js()->reload([$this->name . '_time_zone' => 1]); $misc_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['time_zone' => 'DropDown'], 'config_key' => 'Miscellaneous_Technical_Settings', 'application' => 'base']); $misc_m->tryLoadAny(); if ($misc_m['time_zone']) { $isDone = true; $action = $this->js()->univ()->dialogOK("Already have Data", ' You already have updated the time zone, visit page ? <a href="' . $this->app->url('xepan_communication_generalsetting')->getURL() . '"> click here to go </a>'); } $time_zone_view = $this->add('xepan\\base\\View_Wizard_Step'); $time_zone_view->setAddOn('Application - Base')->setTitle('Update Your Time Zone')->setMessage('Update your time zone accoding your country.')->setHelpMessage('Need help ! click on the help icon')->setHelpURL('#')->setAction('Click Here', $action, $isDone); }
function init() { parent::init(); $this->template->trySet('header', $this->api->page); $this->add('View')->set($this->getHelpText($this->api->page)); //$this->add('Button')->set('Edit')->js('click', $this->js()->reload()); }
function init() { parent::init(); if ($_GET[$this->name . '_task_reminder_mail_content']) { $task_config_mdl = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['reminder_subject' => 'Line', 'reminder_body' => 'xepan\\base\\RichText'], 'config_key' => 'EMPLOYEE_REMINDER_RELATED_EMAIL', 'application' => 'projects']); $task_config_mdl->tryLoadAny(); $task_rem_subject = file_get_contents(realpath(getcwd() . '/vendor/xepan/projects/templates/default/reminder_subject.html')); $task_rem_body = file_get_contents(realpath(getcwd() . '/vendor/xepan/projects/templates/default/reminder_body.html')); if (!$task_config_mdl['reminder_subject']) { $task_config_mdl['reminder_subject'] = $task_rem_subject; } if (!$task_config_mdl['reminder_body']) { $task_config_mdl['reminder_body'] = $task_rem_body; } $task_config_mdl->save(); $this->js(true)->univ()->frameURL("Task Reminder Layout", $this->app->url('xepan_projects_layout')); } $isDone = false; $action = $this->js()->reload([$this->name . '_task_reminder_mail_content' => 1]); $task_config_mdl = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['reminder_subject' => 'Line', 'reminder_body' => 'xepan\\base\\RichText'], 'config_key' => 'EMPLOYEE_REMINDER_RELATED_EMAIL', 'application' => 'projects']); $task_config_mdl->tryLoadAny(); if ($task_config_mdl['reminder_subject'] && $task_config_mdl['reminder_body']) { $isDone = true; $action = $this->js()->univ()->dialogOK("Already have Data", ' You have already set the layout of reminder mail, visit page ? <a href="' . $this->app->url('xepan_projects_layout')->getURL() . '"> click here to go </a>'); } $task_reminder_view = $this->add('xepan\\base\\View_Wizard_Step'); $task_reminder_view->setAddOn('Application - Projects')->setTitle('Set Layout For Task Reminder Mail')->setMessage('Please set layout for sending mail for remind the task.')->setHelpMessage('Need help ! click on the help icon')->setHelpURL('#')->setAction('Click Here', $action, $isDone); }
function init() { parent::init(); $this->setElement('style'); $font_family_config = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['font_family' => 'text'], 'config_key' => 'COMMERCE_DESIGNER_TOOL_FONT_FAMILY', 'application' => 'commerce']); $font_family_config->tryLoadany(); $font_family_config_array = explode(",", $font_family_config['font_family']); $font_family = []; foreach ($font_family_config_array as $key => $value) { $font_family[] = $value . ":bold,bolditalic,italic,regular"; } // Default Fonts if (!count($font_family)) { $font_family_config_array = $font_family = ['Abel', 'Abril Fatface', 'Aclonica', 'Acme', 'Actor', 'Cabin', 'Cambay', 'Cambo', 'Candal', 'Petit Formal Script', 'Petrona', 'Philosopher', 'Piedra', 'Ubuntu']; } // RE DEFINED ALSO AT page_designer_exportpdf $this->js(true)->_library('WebFont')->load(['google' => ['families' => $font_family]]); // custom Fonts $designer_font = $this->add('xepan\\commerce\\Model_DesignerFont'); $custom_fonts = $designer_font->getRows(); $custom_font_array = []; foreach ($custom_fonts as $row) { $custom_font_array[] = $row['name']; } $this->font_list = array_merge($font_family_config_array, $custom_font_array); $this->setModel($designer_font); }
function init() { parent::init(); if (!$this->api->db) { $this->api->dbConnect(); } $this->add('H2')->set('Suggest another example'); $cc = $this->add('View_Columns'); $c1 = $cc->addColumn(); $c1->add('P')->set('Do you have a great idea for example? Post your idea here!'); $f = $c1->add('MVCForm'); $f->setModel('ExampleRequest', array('suggestion')); $f->addSubmit('Suggest'); $g = $cc->addColumn()->add('MVCGrid', null, null, array('grid_striped')); $g->setModel('ExampleRequest', array('suggestion')); $g->addColumn('delete', 'delete'); /* $fRequest->addField('line','your_name')->setProperty('size','60')->js(true)->focus(); $f->addField('line','your_email')->setProperty('size','60'); $f->addField('text','more_information')->setProperty('rows','10')->setProperty('cols','50'); */ if ($f->isSubmitted()) { $f->update(); $g->js(null, $f->getElement('suggestion')->js()->val(''))->reload()->execute(); } }
function init() { parent::init(); $this->namespace = __NAMESPACE__; $public_location = $this->app->pathfinder->addLocation(array('js' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/js'), 'css' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/css')))->setBasePath(getcwd() . '/public')->setBaseURL($this->app->url('/')); $this->api_js_url = 'http://maps.googleapis.com/maps/api/js?sensor=' . $this->sensor; $this->set('Loading Google Map...'); }
function init() { parent::init(); $form = $this->add('Form', null, null, ['form/minimal']); $form->setLayout('form/layout/registration'); $form->setModel('Client'); $form->addSubmit('Confirm')->addClass('atk-swatch-red'); }
function init() { parent::init(); $this->namespace = __NAMESPACE__; $public_location = $this->app->pathfinder->addLocation(array('js' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/js'), 'css' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/css')))->setBasePath(getcwd() . '/public')->setBaseURL($this->app->url('/')); $this->map = $this->add('rvadym\\gmap\\View_Map', $this->map_options, $this->map_spot); $this->l = $this->add('rvadym\\gmap\\Grid_Draw', array('map' => $this->map), $this->grid_spot); }
private static function init_view() { if (self::$config) { View::init(self::$config); } else { die("视图引擎初始化失败。"); } }
function init() { parent::init(); $form_layout = "form/stacked"; if (isset($this->options['form_layout']) and $this->options['form_layout'] === "vertical") { $form_layout = "form"; } $this->form = $form = $this->add('Form', null, null, [$form_layout]); }
function init() { parent::init(); if ($this->status == "submitted") { $this->add('Button', null, 'test_button')->set('Approve')->setClass('btn btn-warning'); } else { $this->add('Button', null, 'test_button')->set('Test')->setClass('btn btn-danger'); } }
function init() { parent::init(); $this->api_js_url = 'http://maps.googleapis.com/maps/api/js?key=' . $this->api->getConfig('map/google/key', '') . '&sensor=true'; $l = $this->api->locate('addons', __NAMESPACE__, 'location'); $this->api->pathfinder->addLocation($this->api->locate('addons', __NAMESPACE__), array('template' => 'templates', 'js' => 'js'))->setParent($l); $this->set('Loading Google Map...'); $this->addApiJs(); }
function init() { parent::init(); $apps = $this->app->xepan_addons; // $apps=['xepan\base','xepan\hr']; foreach ($apps as $addon) { $this->add($addon . '/View_EasySetupWizard'); } }
function init() { parent::init(); $id = $_GET['comm_id']; $communication_model = $this->add('xepan\\communication\\Model_Communication'); $grid = $this->add('View', null, null, ['view/communication/viewer']); $grid->setModel($communication_model->load($id)); $grid->template->trySetHtml('detail', $communication_model['description']); }
function init() { parent::init(); // PREPEND to Common Oprions Div ... $this->js(true)->hide()->prependTo('#common-options-div'); $this->template->trySet('namespace', $this->namespace); $this->template->trySet('component_type', $this->component_type); $this->template->trySet('component_type_name', str_replace("View_Tools_", "", $this->component_type)); }
function init() { parent::init(); $form = $this->add('Form', null, null, ['form/empty']); $form->setLayout('view/tool/userpanel/form/xepanverifyagain'); $form->addField('line', 'email'); $form->onSubmit(function ($f) { try { $user = $this->add('xepan\\base\\Model_User'); $user->addCondition('username', $f['email']); $user->tryLoadAny(); if (!$user->loaded()) { throw $this->exception('Email Id is not registered', 'ValidityCheck')->setField('email'); } $contact = $user->ref('Contacts'); $email_settings = $this->add('xepan\\communication\\Model_Communication_EmailSetting')->tryLoadAny(); $mail = $this->add('xepan\\communication\\Model_Communication_Email'); $frontend_config_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['user_registration_type' => 'DropDown', 'reset_subject' => 'xepan\\base\\RichText', 'reset_body' => 'xepan\\base\\RichText', 'update_subject' => 'Line', 'update_body' => 'xepan\\base\\RichText', 'registration_subject' => 'Line', 'registration_body' => 'xepan\\base\\RichText', 'verification_subject' => 'Line', 'verification_body' => 'xepan\\base\\RichText', 'subscription_subject' => 'Line', 'subscription_body' => 'xepan\\base\\RichText'], 'config_key' => 'FRONTEND_LOGIN_RELATED_EMAIL', 'application' => 'communication']); $frontend_config_m->tryLoadAny(); // $reg_model=$this->app->epan->config; // $email_subject=$reg_model->getConfig('REGISTRATION_SUBJECT'); // $email_body=$reg_model->getConfig('REGISTRATION_BODY'); $email_subject = $frontend_config_m['registration_subject']; $email_body = $frontend_config_m['registration_body']; $merge_model_array = []; $merge_model_array = array_merge($merge_model_array, $user->get()); $merge_model_array = array_merge($merge_model_array, $contact->get()); // $email_body=str_replace("{{name}}",$employee['name'],$email_body); $temp = $this->add('GiTemplate'); $temp->loadTemplateFromString($email_body); $url = $this->api->url(null, ['secret_code' => $user['hash'], 'activate_email' => $f['email'], 'layout' => 'verify_account'])->useAbsoluteURL(); $tag_url = "<a href=\"" . $url . "\">Click Here to Activate </a>"; $subject_temp = $this->add('GiTemplate'); $subject_temp->loadTemplateFromString($email_subject); $subject_v = $this->add('View', null, null, $subject_temp); $subject_v->template->trySet($merge_model_array); $body_v = $this->add('View', null, null, $temp); $body_v->template->trySet($merge_model_array); $t = $body_v->template->trySetHTML('click_here', $tag_url); $t = $body_v->template->trySetHTML('url', $url); $t = $body_v->template->trySetHTML('otp', $user['hash']); $t = $body_v->template->trySetHTML('url', $url); // echo $temp->render(); // exit; $mail->setfrom($email_settings['from_email'], $email_settings['from_name']); $mail->addTo($f['email']); $mail->setSubject($subject_v->getHtml()); $mail->setBody($body_v->getHtml()); $mail->send($email_settings); return $f->js(null, $f->js()->redirect($this->app->url('login', ['layout' => 'login_view', 'message' => $this->options['reactive_message']])))->univ()->successMessage('Secret Code Sent'); } catch (Exception $e) { return $this->js()->univ()->errorMessage('Error'); } }); }
function init() { parent::init(); if ($this->has_top_bar) { $this->addTopBar(); } $cols = $this->add('Columns'); foreach ($this->cols_widths as $cw) { $this->cols[] = $cols->addColumn($cw); } }
function test_render() { $params = array('name' => 'Jill', 'age' => 28); $this->assertEquals('Jill, 28', View::render(function ($params) { return join(', ', $params); })); $this->assertEquals(array(), View::$params); $tpl = new TemplateMock(); View::init($tpl); $this->assertEquals('<p>Hello Jill</p>', View::render('myapp/hello', $params)); }
function init() { parent::init(); $my_followups_model = $this->add('xepan\\projects\\Model_Task'); $my_followups_model->addCondition([['assign_to_id', $this->app->employee->id], ['created_by_id', $this->app->employee->id]]); $my_followups_model->addCondition('starting_date', '>=', $this->app->today); $my_followups_model->addCondition('type', 'Followup'); $my_followups_crud = $this->add('xepan\\hr\\CRUD', ['allow_add' => null, 'grid_class' => 'xepan\\projects\\View_TaskList']); $my_followups_crud->setModel($my_followups_model); $my_followups_crud->grid->template->trySet('task_view_title', 'My FollowUps'); $my_followups_crud->grid->addPaginator(10); }
function init(){ parent::init(); // This will make sure content we add here will pass our current setting along $this->api->stickyGET($this->name); $this->api->template->set('link_comparison',$u=$this->api->getDestinationURL(null,array($this->name=>null))); $this->api->template->set('link_example',$u=$this->api->getDestinationURL(null,array($this->name=>'example'))); $this->api->template->set('link_tour',$this->api->getDestinationURL('intro')); switch($_GET[$this->name]){ case'example': $this->js(true)->_selector('#example')->addClass('current'); $this->js(true)->_selector('#example')->addClass('current'); $p=$this; $this->add('Doc_Code',null,'example') ->setDescr(<<<'EOT' $f=$p->add('Form'); $f->addField('line','name')->validateNotNull(); $f->addField('line','surname'); $f->addSubmit(); if($f->isSubmitted()){ $f->js()->univ()->alert('Thank you, '.$f->get('name'). ' '.$f->get('surname'))->execute(); } EOT ); // Same as above $f=$p->add('Form',null,'form'); $f->addField('line','name')->validateNotNull(); $f->addField('line','surname'); $f->addButton('Try me')->js('click',$f->js()->submit()); if($f->isSubmitted()){ $f->js()->univ()->alert('Thank you, '.$f->get('name').' '.$f->get('surname'))->execute(); } break; case'tour': $this->add('MagicIntro'); break; default: $this->js(true)->_selector('#comparison')->addClass('current'); $this->js(true)->univ()->indexCompareSwitch(); break; } }
/** * Initiated the controller: * @internal Loads components specified in {@link $opts} * * @access public */ public function init() { // load view object $this->View = new View(); $this->View->init(); // load components if (isset($this->opts['components']) && !empty($this->opts['components'])) { if (is_string($this->opts['components'])) { $this->opts['components'] = array($this->opts['components']); } foreach ($this->opts['components'] as $load) { if (is_string($load)) { $load = array('class' => $load); } if (isset($load['var'])) { $var = $load['var']; } else { $var = $load['class']; } if (isset($load['params'])) { $params = $load['params']; } else { $params = array(); } $class = $load['class'] . 'Component'; if (!class_exists($class)) { die('component class ' . $class . ' does not exist!'); } $this->{$var} = new $class(); $this->{$var}->init($params); } } unset($this->opts['components']); // load post data, give it to the controller AND the view if (isset($_POST['data'])) { $this->data = $_POST['data']; $this->View->data = $_POST['data']; } }