本文整理汇总了PHP中View::init方法的典型用法代码示例。如果您正苦于以下问题:PHP View::init方法的具体用法?PHP View::init怎么用?PHP View::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
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]);
}
示例2: init
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);
}
示例3: init
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());
}
示例4: init
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));
}
}
}
示例5: init
public function init()
{
parent::init();
if ($this->owner->swatch) {
$this->addComponents(array('swatch' => $this->owner->swatch));
}
}
示例6: init
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()]));
}
}
}
示例7: init
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)));
}
示例8: init
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();
}
}
示例9: init
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);
}
}
}
示例10: init
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);
}
示例11: init
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());
}
示例12: init
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);
}
示例13: init
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);
}
示例14: init
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();
}
}
示例15: init
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...');
}