本文整理汇总了PHP中Page::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::init方法的具体用法?PHP Page::init怎么用?PHP Page::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
parent::init();
if (!$_GET['t']) {
$this->api->redirect('/');
}
$this->api->stickyGET('t');
$m = $this->add('Model_ATK_User_Pending');
$m->addField('password')->system(true);
$m->loadBy('token_email', $_GET['t']);
if (!$m->isInstanceLoaded()) {
$this->api->redirect($this->api->getDestinationURL('/', array('t' => false)));
}
$this->js(true)->univ()->clickyGoal('Confirmed account');
$form = $this->add('Form');
$form->addField('readonly', 'email', $m->get('email'));
$f = $form->addField('password', 'password', 'Choose password');
$f->add('StrengthChecker', null, 'after_field');
$form->addField('password', 'password_confirm', 'Confirm password');
$form->addSubmit();
$form->onSubmit(function ($form) use($m) {
// Verify password matching
if ($form->get('password') != $form->get('password_confirm')) {
throw $form->exception('Passwords do not match')->setField('password_confirm');
}
$m->set('is_email_confirmed', true);
$m->set('token_email', '');
$m->set('password', $form->api->auth->encryptPassword($form->get('password'), $m->get('email')));
$m->update();
$form->js()->hide('slow')->univ()->dialogOK('Thank you', 'Thank you for completing registration', $form->js()->_enclose()->univ()->redirect($form->api->getDestinationURL('commercial/account', array('t' => false))))->execute();
});
}
示例2: init
function init()
{
parent::init();
$f = $this->add('Form');
$f->addField('myfield', 'name')->setModel('Employee');
$this->add('ViewSource')->setFile($f = 'lib/Form/Field/myfield.php')->template->trySet('title', 'Source of ' . $f);
}
示例3: init
function init()
{
parent::init();
$acl = $this->add('xavoc_acl/Acl');
$crud = $this->add("CRUD");
$crud->setModel("Division");
}
示例4: init
function init()
{
parent::init();
if ($this->api->auth->isLoggedIn()) {
$this->api->redirect('video');
}
$form = $this->add('Form', null, 'LoginForm');
$form->setFormClass('vertical');
$form->addField('line', 'login');
$form->addfield('password', 'password');
$form->addSubmit('Login');
$form->addButton('Sign-up')->js('click')->univ()->location($this->api->getDestinationURL('signup'));
if ($form->isSubmitted()) {
$auth = $this->api->auth;
$l = $form->get('login');
$p = $form->get('password');
// Manually encrypt password
if ($auth->verifyCredintials($l, $p)) {
// Manually log-in
$auth->login($l);
$form->js()->univ()->redirect('video')->execute();
}
$form->getElement('password')->displayFieldError('Incorrect login');
}
}
示例5: init
function init()
{
parent::init();
$form = $this->add('Form');
$form->addField('line', 'name')->validateNotNull();
$form->addField('line', 'email')->validateNotNull();
$form->addField('line', 'phone');
$form->addField('text', 'notes');
$form->addSubmit();
if ($form->isSubmitted()) {
// Perform validation here
if (!filter_var($form->get('email'), FILTER_VALIDATE_EMAIL)) {
$form->displayError('email', 'Incorrect email');
}
// Use TMail object for sending out email
$m = $this->add('TMail');
$m->setTemplate('contact');
// The following line will output contents of email on screen instead of actually sending it
$m->addTransport('echo');
// All fields from a form go into template
$m->set($form->get());
$m->set('subject', 'Contact Request from' . $form->get('name'));
$x = $m->send('you@example.com', $form->get('email'));
$this->js()->univ()->successMessage('Your message was delivered')->execute();
}
$this->add('H3')->set('Mail Template');
// Include source for template
$this->add('ViewSource')->setFile('templates/mail/contact.mail')->template->trySet('title', 'Source of templates/mail/contact.mail');
}
示例6: init
function init()
{
parent::init();
$this->add('View')->set('Not Working Now')->addClass('alert alert-info');
return;
$cols = $this->add('Columns');
$newLetter_col = $cols->addColumn(3);
$btn = $newLetter_col->add('Button')->set('Convert');
$newsletter_form = $newLetter_col->add('Form');
$newsletter_form->addField('DropDown', 'news_letter')->setModel('xEnquiryNSubscription/NewsLetter');
$content_field = $newsletter_form->addField('Text', 'content');
$newsletter_form->addSubmit('Save To');
$js = array();
$js[] = $this->js()->_load('jquery.inlineStyler.src14');
$js[] = $this->js()->_selector('[component_type=Row]')->width('98%');
$js[] = $this->js()->_selector('.email-div')->inlineStyler();
$js[] = $this->js()->_selector('.email-div *')->removeAttr('class');
$js[] = $content_field->js()->val($this->js()->_selector('.email-div')->html());
$btn->js('click', $js);
if ($newsletter_form->isSubmitted()) {
$newsletter = $this->add('xEnquiryNSubscription/Model_NewsLetter');
$newsletter->load($newsletter_form['news_letter']);
$newsletter['matter'] = $newsletter_form['content'];
$newsletter->save();
$this->js()->univ()->closeDialog()->execute();
}
}
示例7: initMainPage
function initMainPage()
{
parent::init();
$f = $this->add('Form');
$drp_class = $f->addField('dropdown', 'class');
$cls = array("%" => "Select Class");
$m = $this->add('Model_Class');
foreach ($m as $a) {
$cls += array($a['id'] => $a['name']);
}
$drp_class->setValueList($cls);
$f->addSubmit('List Students');
$this->api->stickyGET('class');
/* $g = $this->add('MVCGrid');
$r = $this->add('Model_Student_Current');
//$r->hasOne('Scholar','scholar_id');
$r->addCondition('ishostler', true);
$g->setModel($r, array('scholar'));
$g->addColumn('expander', 'allot');
//$g->addCondition('ishostler',true);
if ($_GET['name'])
$g->dq->where('class_id like ', '%' . $_GET['name'] . '%'); */
if ($f->isSubmitted()) {
$this->js()->find('.atk4_loader')->atk4_loader('loadURL', array($this->api->url('./sub'), 'class_id' => $f->get('class')))->execute();
// $g->js(null, $g->js()->reload(array("name" => $f->get('class'))))->execute();
}
$this->add('View')->js(true)->atk4_load($this->api->url('./sub'))->set('Loading..');
}
示例8: init
public function init()
{
parent::init();
if (!$this->auto_test) {
$this->setVariance(array('Test'));
return;
// used for multi-page testing
}
$this->grid = $this->add('Grid');
/** @type Grid $this->grid */
$this->grid->addColumn('template', 'name')->setTemplate('<a href="' . $this->app->url(null, array('testonly' => '')) . '<?$name?>"><?$name?></a>');
$this->setVariance(array('Test'));
//$this->setVariance(array('GiTemplate','SMlite'));
$this->runTests();
if (!$_GET['testonly']) {
/** @type Form $f */
$f = $this->add('Form');
$ff = $f->addField('Text', 'responses');
$this->responses = ' public $proper_responses=array(
' . implode(',
', $this->responses) . '
);';
$ff->set($this->responses);
$ff->js('click')->select();
}
}
示例9: initMainPage
function initMainPage()
{
parent::init();
$f = $this->add('Form', NULL, NULL, array('form_horizontal'));
//=======================================================================================================================
$drp_class = $f->addField('dropdown', 'class');
$cls = array("%" => "p;u");
$m = $this->add('Model_Class');
$f->getElement('class')->setAttr('class', 'hindid');
foreach ($m as $a) {
$cls += array($a['id'] => $a['name']);
}
$drp_class->setValueList($cls);
//=======================================================================================================================
$drp_std = $f->addField('dropdown', 'student')->setEmptyText('p;u');
$r = $this->add('Model_Scholar_Current');
$r->addCondition('ishostler', true);
$drp_std->setModel($r, array('name'));
$f->getElement('student')->setAttr('class', 'hindi');
$drp_class->js('change', $f->js()->atk4_form('reloadField', 'student', array($this->api->getDestinationURL(), 'class_idx' => $drp_class->js()->val())));
if ($_GET['class_idx']) {
$drp_std->dq->where('class_id like ', '%' . $_GET['class_idx'] . '%')->order('fname');
}
//===================================================================================================================
$f->addSubmit('List');
if ($f->isSubmitted()) {
// $this->js()->univ()->successMessage($f->get('student'))->execute();
$this->js()->find('.atk4_loader')->not('.atk-form-field')->atk4_loader('loadURL', array($this->api->url('./list'), 'scholar_id' => $f->get('student')))->execute();
}
$view = $this->add('View');
$view->js(true)->atk4_load($this->api->url('./list'))->set('Loading..');
}
示例10: init
function init()
{
parent::init();
$acl = $this->add('xavoc_acl/Acl');
$form = $this->add('Form');
$class_field = $form->addField('dropdown', 'class')->setEmptyText('----')->setAttr('class', 'hindi');
$class_field->setModel('Class');
$form->addSubmit('GetList');
$grid = $this->add('Grid');
$sc = $this->add('Model_Scholars_Current');
$grid->addColumn('sno', 'sno');
if ($_GET['filter']) {
if ($_GET['class']) {
$sc->addCondition('class_id', $_GET['class']);
}
} else {
$sc->addcondition('class_id', -1);
}
// $grid->addPaginator();
$sc->_dsql()->del('order')->order('fname');
$grid->setModel($sc, array('sno', 'fname', 'hname', 'father_name', 'class', 'contact'));
$grid->setFormatter('class', 'hindi');
if ($form->isSubmitted()) {
$grid->js()->reload(array("class" => $form->get('class'), "filter" => 1))->execute();
}
}
示例11: init
function init()
{
parent::init();
$acl = $this->add('xavoc_acl/Acl');
$form = $this->add('Form', null, null, array('form_horizontal'));
$class_field = $form->addField('dropdown', 'class')->setAttr('class', 'hindi')->setEmptyText('-----');
$student_field = $form->addField('dropdown', 'student')->setAttr('class', 'hindi')->setEmptyText('-----');
$form->addSubmit('Get List');
$v = $this->add('View_StudentMovement');
$c = $this->add('Model_Class');
$s = $this->add('Model_Hosteler');
$s->add('Controller_CurrentSession');
if ($_GET['class_id']) {
$s->addCondition('class_id', $_GET['class_id']);
$s->_dsql()->del('order')->order('fname', 'asc');
}
$s->_dsql()->order('fname', 'asc');
$class_field->setModel($c);
$student_field->setModel($s);
// $s->debug();
$class_field->js('change', $form->js()->atk4_form('reloadField', 'student', array($this->api->url(), 'class_id' => $class_field->js()->val())));
$hm = $this->add('Model_Hosteler');
//
// $hm['session_id']=$this->add('Model_Sessions_Current')->tryLoadAny()->get('id');
if ($_GET['hostler_id']) {
$hm->addCondition('id', $_GET['hostler_id']);
} else {
$hm->addCondition('id', 0);
}
$v->setModel($hm);
if ($form->isSubmitted()) {
// throw $this->exception($form->get('student'));
$v->js()->reload(array('hostler_id' => $form->get('student')))->execute();
}
}
示例12: init
function init()
{
parent::init();
$acl = $this->add('xavoc_acl/Acl');
$c = $this->add('Model_Class');
$form = $this->add('Form');
$class_field = $form->addField('dropdown', 'class')->setEmptyText('-----')->setAttr('class', 'hindi');
$class_field->setModel($c);
$form->addSubmit("Get List");
$h = $this->add('Model_Hosteler');
$h->add('Controller_CurrentSession');
$h->_dsql()->del('order')->order('building_name', 'asc')->order('room_no', 'asc')->order('class', 'asc');
// $h->_dsql()->order('scholar','asc');
if ($_GET['filter']) {
$h->addCondition('class_id', $_GET['class']);
}
// else{
// $h->addCondition('class_id',-1);
// }
$grid = $this->add('Grid');
$grid->addColumn('sno', 'sno');
$grid->setModel($h, array('sno', 'name', 'class', 'building_name', 'room_no'));
// $grid->addFormatter('scholar','hindi');
$grid->addFormatter('class', 'hindi');
if ($form->isSubmitted()) {
$grid->js()->reload(array("class" => $form->get('class'), "filter" => -1))->execute();
}
}
示例13: init
function init()
{
parent::init();
$this->api->addLocation('atk4-addons', array('php' => 'misc/lib'));
$c = $this->add('Columns');
$left_column = $c->addColumn(6);
$form = $left_column->add('Form');
$form->addClass('stacked');
$form->setModel($this->api->auth->model, array('first_name', 'last_name', 'email'));
$form->addSubmit();
if ($form->isSubmitted()) {
$form->update();
$form->js()->univ()->successMessage('Saved')->execute();
}
$right_column = $c->addColumn(6);
$form = $right_column->add('Form');
$form->setModel($this->api->auth->model, array('password'));
$form->getElement('password')->add('StrengthChecker', null, 'after_field');
$form->addField('password', 'password_confirm');
$form->addSubmit('Change Password');
$form->addClass('stacked');
if ($form->isSubmitted()) {
if ($form->get('password') != $form->get('password_confirm')) {
$form->displayError('password', 'Passwords should match');
}
$form->update();
$form->js()->univ()->successMessage('Password Changed')->execute();
}
}
示例14: init
function init()
{
parent::init();
$page = $this;
$this->add('H1')->set('VERY UNCOMPLETE AND ROUGH WORK TILL YET');
$this->add('H1')->set('Session and Classes ->comlpeted and working on Scholar menu now');
}
示例15: init
function init()
{
parent::init();
/* dirty. will clean up later, but working well */
$this->add("Text")->set("Welcome. This is Model Creator Kit. It will use mysql database to create models for you");
$c = $this->add('Columns');
$f = $c->addColumn('50%')->add('Form');
$l = $this->api->locatePath('php', 'Model');
list($tables, $fields) = $this->findModels();
$tables = array("-1" => "All") + $tables;
$f->addField('dropdown', 'table')->setValueList($tables);
$f->addButton('create')->js("click", $f->js()->submit());
$r = $c->addColumn('50%');
$output_object = $r->add('HtmlElement');
$create_object = $r->add('HtmlElement')->setElement('pre');
if ($f->isSubmitted()) {
$code = "";
if ($f->get("table") == -1) {
foreach ($tables as $k => $table) {
if ($k > -1) {
$code .= htmlspecialchars($this->generateModel($table, $fields[$table], $tables));
}
}
} else {
$code = $this->generateModel($tables[$f->get("table")], $fields[$tables[$f->get("table")]], $tables);
}
$create_object->js()->html($code)->execute();
return;
}
}