Example #1
0
 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();
     });
 }
Example #2
0
 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);
 }
Example #3
0
 function init()
 {
     parent::init();
     $acl = $this->add('xavoc_acl/Acl');
     $crud = $this->add("CRUD");
     $crud->setModel("Division");
 }
Example #4
0
 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');
     }
 }
Example #5
0
 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('*****@*****.**', $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');
 }
Example #6
0
 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();
     }
 }
Example #7
0
 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..');
 }
Example #8
0
File: Tester.php Project: atk4/atk4
 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();
     }
 }
Example #9
0
 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..');
 }
Example #10
0
 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();
     }
 }
Example #11
0
 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();
     }
 }
Example #12
0
 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();
     }
 }
Example #13
0
 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();
     }
 }
Example #14
0
 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');
 }
Example #15
0
 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;
     }
 }
Example #16
0
 function init()
 {
     parent::init();
     if (!$this->app->auth->isLoggedIn()) {
         return;
     }
     if (!$_GET['xepan-tool-to-clone']) {
         return $this->add('View')->set('Please select a tool');
     }
     $tool = $this->add($_GET['xepan-tool-to-clone']);
     if (!$tool->teplateOverridable) {
         $this->add('View')->set('You cannot override template for this tool');
         return;
     }
     $original_path = $tool->template->origin_filename;
     $tool->destroy();
     $specific_path = substr($original_path, strpos($original_path, '/templates/') + strlen('/templates/'));
     $override_path = $this->app->pathfinder->base_location->base_path . '/websites/' . $this->app->current_website_name . '/www/' . $specific_path;
     if (file_exists($override_path)) {
         $this->add('View')->set('File allrealy overrided at "' . $specific_path . '", Please remove this file and click again to reset');
         return;
     }
     $fs = \Nette\Utils\FileSystem::copy($original_path, $override_path, true);
     $this->add('View')->set('Tool template is overrided at "' . $specific_path . '", PLease use file manager in admin to edit file');
 }
Example #17
0
 function init()
 {
     parent::init();
     $this->add('View_RepairBox');
     $this->js()->_load('ui.atk4_notify');
     $this->api->versionRequirement('4.0.99');
     $f = $this->add('Form');
     for ($i = 0; $i < 5; $i++) {
         $r = $f->addField('autocomplete', 'n' . $i, 'Employee');
         $r->setModel('Employee');
         $r->setAttr('rel', json_encode(array('salary')));
         $s = $f->addField('line', 's' . $i, 'Set Salary');
         $r->js(true)->univ()->bindFillInFields(array('salary' => $s));
     }
     $f->addSubmit();
     $m = $this->add('Model_Employee');
     if ($f->isSubmitted()) {
         for ($i = 0; $i < 5; $i++) {
             $emp = $f->get('n' . $i);
             if ($emp) {
                 $m->loadData($emp)->set('salary', $f->get('s' . $i))->update();
             }
         }
         $f->js()->univ()->successMessage('Updated')->execute();
     }
 }
Example #18
0
 function init()
 {
     parent::init();
     if (!$this->api->auth->isLoggedIn()) {
         $this->js()->univ()->errorMessage('You Are Not Logged In')->execute();
     }
     if ($_POST['length'] != strlen($_POST['body_html'])) {
         $this->js()->univ()->successMessage('Length send ' . $_POST['length'] . " AND Length calculated again is " . strlen($_POST['body_html']))->execute();
     }
     if ($_POST['crc32'] != sprintf("%u", crc32($_POST['body_html']))) {
         $this->js()->univ()->successMessage('CRC send ' . $_POST['crc32'] . " AND CRC calculated again is " . sprintf("%u", crc32($_POST['body_html'])))->execute();
     }
     try {
         $content = urldecode($_POST['body_html']);
         $template = $this->add('Model_EpanTemplates')->load($_GET['template_id']);
         $template['content'] = $content;
         $template['body_attributes'] = urldecode($_POST['body_attributes']);
         $template->save();
     } catch (Exception_StopInit $e) {
     } catch (Exception $e) {
         $this->js()->univ()->errorMessage('Error... Could not save your page ' . $e->getMEssage())->excute();
         exit;
     }
     echo "saved";
     exit;
 }
Example #19
0
 function init()
 {
     parent::init();
     $this->db = $this->add('DB');
     try {
         $this->db->query('drop table author');
     } catch (PDOException $e) {
     }
     try {
         $this->db->query('drop table book');
     } catch (PDOException $e) {
     }
     $this->db->query('create table author (id int not null primary key auto_increment, long_name varchar(255), DOB date)');
     $this->db->query('create table book (id int not null primary key auto_increment, title varchar(255), isbn varchar(255), pages int, author_id int)');
     $m = $this->add('Model_Author53');
     $m['long_name'] = 'John Smith';
     $m->saveAndUnload();
     $m['long_name'] = 'Joe Blogs';
     $m->saveAndUnload();
     $m = $this->add('Model_Book53');
     $m['author_id'] = 1;
     $m['title'] = 'John\'s Book';
     $m->save();
     $this->add('CRUD')->setModel('Book53');
 }
Example #20
0
 /**
  * Initialize the page
  *
  * @return void
  */
 function init()
 {
     parent::init();
     $this->app->layout->template->tryDel('has_title');
     $this->add('H2')->set('Step 1: Install Dokku-alt');
     $this->add('View_Info')->setHTML('You will need to launch a new host first and install Dokku-alt on that host. <a href="https://github.com/dokku-alt/dokku-alt#requirements" target="_blank">Dokku-alt Installation Instructions</a>');
     $this->add('H2')->set('Step 2: Fill out this form');
     $form = $this->add('Form');
     $form->setModel('dokku_alt/Host', ['addr', 'name', 'private_key']);
     $form->getElement('addr')->setFieldHint('mysite.example.com');
     $form->getElement('private_key')->setFieldHint('If you leave this field empty, the application will find appropriate key in Keychain');
     $form->addSubmit('Continue');
     $form->addButton('Back')->link($this->app->url('/'));
     $form->onSubmit(function ($f) {
         $f->update();
         try {
             $version = $f->model->executeCommand('version');
         } catch (Exception $e) {
             $f->model->delete();
             return $f->error('addr', $e->getMessage());
         }
         if (!$version) {
             $f->model->delete();
             return $f->error('addr', 'Could not connect or dokku-alt was not installed');
         }
         return 'Added new host with version ' . $version;
     });
 }
Example #21
0
 function init()
 {
     parent::init();
     // $this->query('ALTER TABLE `marksheet_designer` ADD `declare_date` DATETIME NOT NULL ');
     // $this->query('DROP TABLE IF EXISTS `grade_master` ;
     // 				CREATE TABLE `grade_master` (
     // 				`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
     // 				`percent_above` int( 11 ) NOT NULL ,
     // 				`name` varchar( 1 ) NOT NULL ,
     // 				`session_id` int( 11 ) NOT NULL ,
     // 				PRIMARY KEY ( `id` )
     // 				) ENGINE = InnoDB DEFAULT CHARSET = latin1;');
     // $this->query(" ALTER TABLE `fee` ADD `for_hostler_only` TINYINT NOT NULL AFTER `scholaredamount` ");
     // $this->query('ALTER TABLE `student` ADD `result_stopped` TINYINT NOT NULL ');
     $this->query("  ALTER TABLE `hosteller_outward` ADD COLUMN `session_id`  int(11) NOT NULL AFTER `remark`");
     $this->query("  ALTER TABLE `rooms` ADD `session_id` INT NOT NULL ");
     // $this->query("  ALTER TABLE `fee_deposit_master` CHANGE `remarks` `remarks` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ");
     $this->query("  ALTER TABLE `staff_outward` ADD COLUMN `session_id`  int(11) NOT NULL AFTER `staff_id`");
     // $this->query("  ALTER TABLE `student` MODIFY COLUMN `result_stopped`  tinyint(4) NOT NULL AFTER `is_present`");
     $this->query("  ALTER TABLE `staff_master` ADD `is_active` TINYINT NOT NULL");
     $this->query(" ALTER TABLE `scholars_master` ADD `previouse_school_name` VARCHAR( 255 ) NOT NULL");
     $this->query(" ALTER TABLE `scholars_master` ADD `previouse_class_name` VARCHAR( 255 ) NOT NULL");
     $this->query(" ALTER TABLE `scholar_guardian` ADD `is_active` TINYINT NOT NULL DEFAULT '0'");
     // SECOND FILE CORRECTIONS ....
     // $this->query('ALTER TABLE `hosteller_outward` ADD `session_id` INT NOT NULL ');
     $this->query('UPDATE `rooms` SET `session_id`=8');
     $this->query('UPDATE `hosteller_outward` SET `session_id`=8');
     $this->query('UPDATE `staff_outward` SET `session_id`=8');
 }
Example #22
0
File: Page.php Project: xepan/base
 function init()
 {
     parent::init();
     if (!$this->app->auth->isLoggedIn() || !in_array($this->app->auth->model['scope'], ['AdminUser', 'SuperUser'])) {
         throw $this->exception('You are not authorised to access this page')->addMoreInfo('User Type', $this->app->auth->model['scope'])->addMoreInfo('User_id', $this->app->auth->model->id)->addMoreInfo('User', $this->app->auth->model['name'])->addMoreInfo('isLoggedIn', $this->app->auth->isLoggedIn())->addMoreInfo('page', $this->app->page);
     }
     $breadcrumbs = [];
     foreach ($this->breadcrumb as $title => $url) {
         $active = '';
         if ($url == '#') {
             $active = 'active';
         } else {
             if (is_array($url)) {
                 $_url = $url[0];
                 unset($url[0]);
                 $_params = $url;
                 $url = $this->app->url($url, $_params);
             } else {
                 $url = $this->app->url($url);
             }
         }
         $breadcrumbs[] = ['title' => $title, 'url' => $url, 'active' => $active];
     }
     $br = $this->app->layout->add('CompleteLister', null, 'breadcrumb', ['layout/cube', 'breadcrumb']);
     $br->setSource($breadcrumbs);
 }
Example #23
0
 function init()
 {
     parent::init();
     $page = $this;
     $tabs = $page->add('Tabs');
     $tabs->addTab('Product')->add('CRUD')->setModel('Product');
 }
Example #24
0
 function init()
 {
     parent::init();
     /* 
     
     		// Example 1
     
     		$q=$this->api->db->dsql();
     
     		$q->debug();
     
     		$name = $q->table('user')->field('first_name')->getOne();
     		echo $name;
     
     		/*  */
     /* */
     // Example 2
     $q = $this->api->db->dsql();
     $q->table('item')->field('title')->field('first_name');
     $q->field($q->expr('length(title)'), 'len');
     $q->join('user');
     $q->where('first_name', $q->getField('title'));
     $q->debug();
     foreach ($q as $row) {
         echo $row['title'] . " (" . $row['len'] . ")" . ' by ' . $row['first_name'] . ' in ' . $row['country'] . '<br/>';
     }
     //$q->where('email','*****@*****.**');
     //$q->field($q->expr('(select name from country where country.id=country_id)'),'country');
     //	$q->getField('country_id')
     /* */
     exit;
 }
Example #25
0
 function init()
 {
     parent::init();
     $options = array();
     $zoom = $options['zoom'] = $_GET['zoom'];
     $options['font_size'] = $_GET['font_size'] * $zoom;
     // $options['font_size'] = $_GET['font_size'] * ($zoom / 1.328352013);
     $options['font'] = $_GET['font'];
     $options['text'] = $_GET['text'];
     $options['text_color'] = $_GET['color'];
     $options['desired_width'] = $_GET['width'] * $zoom;
     $options['bold'] = $_GET['bold'] == 'true' ? true : false;
     $options['italic'] = $_GET['italic'] == 'true' ? true : false;
     $options['underline'] = $_GET['underline'] == 'true' ? true : false;
     $options['alignment_justify'] = $_GET['alignment_justify'] == 'true' ? true : false;
     $options['alignment_center'] = $_GET['alignment_center'] == 'true' ? true : false;
     $options['alignment_left'] = $_GET['alignment_left'] == 'true' ? true : false;
     $options['alignment_right'] = $_GET['alignment_right'] == 'true' ? true : false;
     $options['rotation_angle'] = $_GET['rotation_angle'];
     $options['stokethrough'] = $_GET['stokethrough'] == 'true' ? true : false;
     $base_font_path = getcwd();
     //->url()->absolute()->getBaseURL();
     $base_font_path .= "/vendor/xepan/commerce/templates/fonts/";
     $cont = $this->add('xepan\\commerce\\Controller_RenderText', array('options' => $options, 'base_font_path' => $base_font_path));
     // var_dump($options);
     $cont->show('png', 3, true, false);
     // exiting as well
 }
Example #26
0
 function init()
 {
     parent::init();
     $acl = $this->add('xavoc_acl/Acl');
     $crud = $this->add('CRUD');
     $crud->setModel('Subject');
 }
Example #27
0
 function init()
 {
     parent::init();
     // If you want to use database on all pages - move next line into Frontend.php, init() method
     $this->api->dbConnect();
     $this->add('HtmlElement')->setElement('P')->set('Successfully connected to database.');
 }
Example #28
0
 function init()
 {
     parent::init();
     $c = $this->add('CRUD');
     $m = $this->add('Model_Staff');
     $c->setModel('Staff', null, array('name', 'designation', 'contact'));
     if ($c->form) {
         // make form flow in 2 columns
         $c->form->setFormClass('stacked atk-row');
         $o = $c->form->add('Order')->move($c->form->addSeparator('noborder span6'), 'first')->move($c->form->addSeparator('noborder span5'), 'middle')->now();
         $c->form->getElement('hname')->setAttr('class', 'hindi');
         $c->form->getElement('designation')->setAttr('class', 'hindi');
         $c->form->getElement('father_name')->setAttr('class', 'hindi');
         $c->form->getElement('mother_name')->setAttr('class', 'hindi');
         $c->form->getElement('guardian_name')->setAttr('class', 'hindi');
         $c->form->getElement('address')->setAttr('class', 'hindi');
     }
     if ($c->grid) {
         $q = $this->api->db->dsql()->expr('SELECT filestore_file.filename as image FROM staff_master, filestore_file WHERE filestore_file.id = staff_master.image');
         $c->grid->addPaginator(15);
         $c->grid->addColumn('template', 'name')->setTemplate('<div class="hindi"><?$name?></div>');
         $c->grid->addColumn('template', 'designation')->setTemplate('<div class="hindi"><?$designation?></div>');
         $c->grid->addColumn('text', 'contact');
     }
 }
Example #29
0
 function init()
 {
     parent::init();
     $this->js('click')->_selector('#download-button')->univ()->frameURL('Downloading Agile Toolkit', $this->api->getDestinationURL('/download/box'));
     $this->js('click')->_selector('#buy-single')->univ()->frameURL('Purchase single-domain license', $this->api->getDestinationURL('/commercial/checkout', array('type' => 'Single')));
     $this->js('click')->_selector('#buy-multi')->univ()->frameURL('Purchase single-domain license', $this->api->getDestinationURL('/commercial/checkout', array('type' => 'Multi')));
 }
Example #30
0
 function init()
 {
     parent::init();
     header('HTTP/1.0 404 Not Found');
     echo "404- Page not found";
     exit;
 }