/** * Singleton pattern. Get the instance of the latest created object or create a new one. * @return CLydia The instance of this class. */ public static function Instance() { if (self::$instance == null) { self::$instance = new Origin(); } return self::$instance; }
public function __construct() { parent::__construct(true, true); $this->userIP = $this->fun->getIP(); set_include_path(dirname(dirname(__FILE__)) . '/Class/QQ/'); require_once 'OpenSDK/Tencent/Weibo.php'; OpenSDK_Tencent_Weibo::init(TX_appkey, TX_appsecret); }
public function __construct() { parent::__construct(true, true); set_include_path(dirname(dirname(__FILE__)) . '/Class/Sina/'); require_once 'saetv2.ex.class.php'; $this->sina = new SaeTOAuthV2(WB_AKEY, WB_SKEY); $this->userIP = $this->fun->getIP(); }
/** * Authenticate and login a user. */ public function Login() { $form = new CFormUserLogin($this); if ($form->Check() === false) { $this->AddMessage('notice', 'You must fill in acronym and password.'); $this->RedirectToController('login'); } $this->views->SetTitle('Login')->AddInclude(__DIR__ . '/login.tpl.php', array('login_form' => $form, 'allow_create_user' => Origin::Instance()->config['create_new_users'], 'create_user_url' => $this->CreateUrl(null, 'create'))); }
/** * Constructor * * @param string name of the element. * @param array attributes to set to the element. Default is an empty array. */ public function __construct($name, $attributes = array()) { $this->attributes = $attributes; $this['name'] = $name; if (is_callable('Origin::Instance()')) { $this->characterEncoding = Origin::Instance()->config['character_encoding']; } else { $this->characterEncoding = 'UTF-8'; } }
/** * Constructor, can be instantiated by sending in the $ly reference. */ protected function __construct($Origo = null) { if (!$Origo) { $Origo = Origin::Instance(); } $this->Origo =& $Origo; $this->config =& $Origo->config; $this->request =& $Origo->request; $this->data =& $Origo->data; $this->db =& $Origo->db; $this->views =& $Origo->views; $this->session =& $Origo->session; $this->user =& $Origo->user; }
/** * Create a method that shows the menu, same for all methods */ private function Menu() { $Origo = Origin::Instance(); $menu = array('index', 'index/index', 'developer', 'developer/index', 'developer/links', 'developer/display-object', 'guestbook'); $html = null; foreach ($menu as $val) { $html .= "<li><a href='" . $this->request->CreateUrl($val) . "'>{$val}</a>"; } $this->data['title'] = "Developer"; $this->data['main'] = <<<EOD \t<h1>The Developer Controller</h1> \t<p>This is what you can do for now:</p> \t<ul> \t{$html} \t</ul> EOD; }
?> <?php echo $form->datepickerRow($model, 'date_received', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->dropDownListRow($model, 'cat_id', CHtml::listData(Category::model()->findAll(), 'cat_id', 'cat_name'), array('class' => 'span4', 'prompt' => '------ Select Category ------')); ?> <?php echo $form->dropDownListRow($model, 'type_comm', array(0 => 'Urgent', 1 => 'Not Urgent'), array('class' => 'span4', 'prompt' => '------ Select Type of Communication ------')); ?> <?php echo $form->dropDownListRow($model, 'orig_id', CHtml::listData(Origin::model()->findAll(), 'orig_id', 'orig_name'), array('class' => 'span4', 'prompt' => '------ Select Origin ------')); ?> <?php echo $form->datepickerRow($model, 'date_agenda', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Search')); ?> </div> </div> <?php $this->endWidget();
/** * Check if region has views. Accepts variable amount of arguments as regions. * * @param $region string the region to draw the content in. */ function region_has_content($region = 'default') { return Origin::Instance()->views->RegionHasView(func_get_args()); }
/** * @param array $source */ public function __construct($source) { parent::__construct(DjaBase::UNKNOWN_SOURCE); $this->source = $source; }
<?php /** * All requests routed through here. This is an overview of what actaully happens during * a request. * * @package LydiaCore */ // --------------------------------------------------------------------------------------- // // PHASE: BOOTSTRAP // define('LYDIA_INSTALL_PATH', dirname(__FILE__)); define('LYDIA_SITE_PATH', LYDIA_INSTALL_PATH . '/site'); require LYDIA_INSTALL_PATH . '/src/Origin/bootstrap.php'; $Origo = Origin::Instance(); $Origo->a = 1; // --------------------------------------------------------------------------------------- // // PHASE: FRONTCONTROLLER ROUTE // $Origo->FrontControllerRoute(); // --------------------------------------------------------------------------------------- // // PHASE: THEME ENGINE RENDER // $Origo->ThemeEngineRender();
function render_own($region = 'default', $nav = 'site/themes/lingon/meny.tpl.php') { $Origo = Origin::Instance(); $info = $Origo->config['menus']['lingon']; return Origin::Instance()->views->Render($region, $nav, $info); }
/** * Add Role for super user * * Add user have id = 1 to role's id = 1 */ public function addRootOrigin() { $rootOrigin = array('aid' => 1, 'rid' => 1); $origin = Origin::model()->findByPk($rootOrigin); if (empty($origin)) { $add = new Origin(); $add->attributes = $rootOrigin; try { $add->save(); $this->redirect('/admin'); } catch (Exception $ex) { $data['errmsg'] = $ex->getMessage(); $this->render('origin', $data); } } else { $this->redirect('/admin'); } }
} /** * 取得post数组 */ public function __get_post() { return $this->fun->pars_all('post', true); } /** * 加载处理的文件 */ public function _Origin_dispose() { //定义时区 date_default_timezone_set('PRC'); //开启缓冲 ob_start(); if (!isset($_SESSION)) { session_start(); } $this->load_file($this->get['O']); $dispose = new $this->get['O'](); if ($this->get['A']) { $dispose->{$this->get['A']}(); } } } //$dot = new Origin(0,0,1); //$dot->db->echoErr('正在升级当前版本,请稍后访问'); $dot = new Origin(); $dot->_Origin_dispose();
?> <?php echo $form->datepickerRow($model, 'date_agenda', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->fileFieldRow($model, 'comm_letter'); } else { ?> <?php echo $form->dropDownListRow($model, 'type_comm', array(0 => 'Urgent', 1 => 'Not Urgent'), array('class' => 'span4', 'prompt' => '------ Select Type of Communication ------')); ?> <?php echo $form->select2Row($model, 'orig_id', array('asDropDownList' => true, 'data' => CHtml::listData(Origin::model()->findAll(array('order' => 'orig_name asc')), 'orig_id', 'orig_name'), 'multiple' => 'multiple', 'data-placeholder' => ' ------------ Select Origin ------------', 'options' => array('maximumSelectionSize' => 1, 'width' => '63%'))); ?> <?php echo $form->datepickerRow($model, 'date_agenda', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->fileFieldRow($model, 'comm_letter'); } ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Submit' : 'Save', 'htmlOptions' => array('confirm' => 'Do you want to continue?'))); $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'reset', 'type' => 'warning', 'label' => 'Reset', 'htmlOptions' => array('style' => 'margin-left:1%;')));
/** * Helper, wrap html_entites with correct character encoding */ function htmlent($str, $flags = ENT_COMPAT) { return htmlentities($str, $flags, Origin::Instance()->config['character_encoding']); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Origin the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Origin::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Create password. * * @param $plain string the password plain text to use as base. * @param $algorithm string stating what algorithm to use, plain, md5, md5salt, sha1, sha1salt. * defaults to the settings of site/config.php. * @returns array with 'salt' and 'password'. */ public function CreatePassword($plain, $algorithm = null) { $password = array('algorithm' => $algorithm ? $algoritm : Origin::Instance()->config['hashing_algorithm'], 'salt' => null); switch ($password['algorithm']) { case 'sha1salt': $password['salt'] = sha1(microtime()); $password['password'] = sha1($password['salt'] . $plain); break; case 'md5salt': $password['salt'] = md5(microtime()); $password['password'] = md5($password['salt'] . $plain); break; case 'sha1': $password['password'] = sha1($plain); break; case 'md5': $password['password'] = md5($plain); break; case 'plain': $password['password'] = $plain; break; default: throw new Exception('Unknown hashing algorithm'); } return $password; }
public function __construct() { parent::__construct(true, true, true); }
/** * Callback to delete the content. */ public function DoDelete($form, $content) { $content['id'] = $form['id']['value']; $content->Delete(); Origin::Instance()->RedirectTo('content'); }
<?php /* @var $this ResolutionController */ /* @var $dataProvider CActiveDataProvider */ $this->breadcrumbs = array('Resolutions'); $this->menu = array(array('label' => 'Create Resolution', 'url' => array('create')), array('label' => 'Manage Resolution', 'url' => array('admin'))); $this->menu = array(array('label' => 'Monthly Committee Reports', 'url' => array('reportsOthers/commReportMonthly')), array('label' => 'Yearly Committee Reports', 'url' => array('reportsOthers/commReportYearly')), array('label' => 'Monitor Ordinances', 'url' => array('monitorOrd/index')), array('label' => 'Track Communications', 'url' => array('reportsOthers/viewTracking'))); Yii::app()->clientScript->registerScript('search', "\r\n\r\n\$('.search-form form').submit(function(){\r\n\t\$('#track-communication-for-resolution-grid').yiiGridView('update', {\r\n\t\tdata: \$(this).serialize()\r\n\t});\r\n\treturn false;\r\n});\r\n\r\n\$('.search-form form').submit(function(){\r\n\t\$('#track-communication-for-ordinance-grid').yiiGridView('update', {\r\n\t\tdata: \$(this).serialize()\r\n\t});\r\n\treturn false;\r\n});\r\n"); $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Track Communications for Resolution', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:126%; text-align:center;'))); ?> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'track-communication-for-resolution-grid', 'dataProvider' => $forResolution->forResolution(), 'filter' => Communication::model(), 'htmlOptions' => array('style' => 'padding:15px', 'style' => 'width:100%;'), 'template' => "{items}{pager}", 'columns' => array(array('name' => 'ctrl_no', 'value' => '$data->ctrl_no', 'htmlOptions' => array('style' => 'width:10%;')), array('header' => 'Agenda Date', 'value' => '$data->date_agenda'), array('header' => 'Origin', 'filter' => CHtml::listData(Origin::model()->findAll(), 'orig_id', 'orig_name'), 'value' => '$data->orig->orig_name'), array('name' => 'subject_matter', 'value' => '$data->subject_matter', 'htmlOptions' => array('style' => 'width:20%;')), array('header' => 'Date Referred', 'value' => ' $data->getReferral($data->ctrl_no)'), array('header' => 'Date Meeting/s', 'value' => '$data->getCommMeetings($data->ctrl_no)'), array('header' => 'Action Taken', 'value' => '$data->getActionTaken($data->ctrl_no)'), array('header' => 'Date Reported', 'value' => '$data->getCommReport($data->ctrl_no)'), array('header' => 'Ordinance/Resolution No.', 'value' => '$data->getTitle($data->ctrl_no)')))); ?> <?php $this->endWidget(); ?> <?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Track Communications for Ordinance', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:126%; text-align:center;'))); ?> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'track-communication-for-ordinance-grid', 'dataProvider' => $forOrdinance->forOrdinance(), 'filter' => $forOrdinance, 'htmlOptions' => array('style' => 'padding:15px', 'style' => 'width:100%;'), 'template' => "{items}{pager}", 'columns' => array('ctrl_no', array('header' => 'Agenda Date', 'value' => '$data->date_agenda'), array('header' => 'Origin', 'value' => '$data->orig->orig_name'), array('name' => 'subject_matter', 'value' => '$data->subject_matter'), array('header' => 'Date Referred', 'value' => ' $data->getReferral($data->ctrl_no)'), array('header' => 'Date Meeting/s', 'value' => '$data->getCommMeetings($data->ctrl_no)'), array('header' => 'Action Taken', 'value' => '$data->getActionTaken($data->ctrl_no)'), array('header' => 'Date Reported', 'value' => '$data->getCommReport($data->ctrl_no)'), array('header' => 'Ordinance/Resolution No.', 'value' => '$data->getTitle($data->ctrl_no)')))); ?>
public function __construct($display_name, $loader, $name, $dirs) { parent::__construct($display_name); $this->loader = $loader; $this->loadname = $name; $this->dirs = $dirs; }