本文整理汇总了PHP中Prado::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::getApplication方法的具体用法?PHP Prado::getApplication怎么用?PHP Prado::getApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCache
protected function getCache()
{
if (!$this->_cache) {
$this->_cache = Prado::getApplication()->getCache();
}
return $this->_cache;
}
示例2: getData
protected function getData($offset, $limit)
{
$session = Prado::getApplication()->getSession();
$langID = $session->itemAt('jezyk');
$this->DataGrid->DataSource = PagesRecord::finder()->findAll('LanguageID = ? AND PageID = 19 ORDER BY Position', $langID);
return $this->DataGrid->dataBind();
}
示例3: onLoad
public function onLoad($param)
{
parent::onLoad($param);
$app = $this->getApplication();
$usedId = $app->getUser()->getUserID() == null ? 0 : $app->getUser()->getUserID();
$cmd = $this->db->createCommand("SELECT user_id FROM hr_superusers WHERE id={$usedId}");
$data = $cmd->query();
$dataUser = $data->read();
$this->userId = $dataUser['user_id'];
$this->employee = new employee($this->userId);
$this->tbb->setTitle(Prado::localize("Leave request") . " - " . $this->employee->getFullName());
if (!$this->IsPostBack) {
if (Prado::getApplication()->getSession()->contains($this->getApplication()->getService()->getRequestedPagePath() . 'FilterState')) {
$FilterState = $this->Session[$this->getApplication()->getService()->getRequestedPagePath() . 'FilterState'];
} else {
$FilterState = 'all';
}
$this->FilterState->setSelectedValue($FilterState);
$this->DataGrid->DataSource = $this->Data;
$this->DataGrid->dataBind();
}
if (isset($this->Request['okMsg'])) {
$this->displayMessage($this->Request['okMsg'], true);
}
if (isset($this->Request['koMsg'])) {
$this->displayMessage($this->Request['koMsg'], false);
}
}
示例4: onImport
public function onImport($sender, $param)
{
$session = Prado::getApplication()->getSession();
$session['format'] = $this->format->Value;
//////$session['csv_terminated'] = $this->csv_terminated->SafeText;
//////$session['csv_enclosed'] = $this->csv_enclosed->SafeText;
//////$session['csv_escaped'] = $this->csv_escaped->SafeText;
$session['tbl_name'] = $this->tbl_name->SafeText;
//W$session['csv_new_line'] = $this->csv_new_line->SafeText;
//$session['csv_col_names'] = $this->csv_col_names->Value;
$this->file->saveAs("./tmp/" . $this->file->Filename);
$session['upfile'] = $this->file->FileName;
$cbs = $this->findControlsByType("TActiveCheckBox");
$session['selected_conf'] = "";
if ($this->custom_config->Checked) {
foreach ($cbs as $cb) {
if ((bool) $cb->getChecked() && $cb->Value != "0") {
$session['selected_conf'] = $cb->Value;
}
}
}
$this->Response->redirect($this->Service->constructUrl('components.export.importData'));
/* $msg = array('okMsg'=>Prado::localize('...'));
$this->Response->redirect($this->Service->constructUrl('components.export.import',$msg));*/
}
示例5: setup
function setup()
{
parent::setup();
$app = Prado::getApplication();
$this->userDao = $app->getModule('daos')->getDao('UserDao');
$this->flushDatabase();
}
示例6: getShortLang
public function getShortLang()
{
$source = Prado::getApplication()->getGlobalization();
if (Prado::getApplication()->getRequest()->contains('culture')) {
$source->setCulture(Prado::getApplication()->getRequest()->itemAt('culture'));
}
return $source->getCulture();
}
示例7: setup
function setup()
{
parent::setup();
$app = Prado::getApplication();
$this->categoryDao = $app->getModule('daos')->getDao('CategoryDao');
$this->projectDao = $app->getModule('daos')->getDao('ProjectDao');
$this->flushDatabase();
}
示例8: createNewInstance
/**
* Creates a new instance of TimeTrackerUser
* @param array result data
* @return TimeTrackerUser new user instance
*/
public function createNewInstance($row = null)
{
$manager = Prado::getApplication()->getModule('users');
if (is_null($manager)) {
$manager = new UserManager();
}
return new TimeTrackerUser($manager);
}
示例9: getComponentShortCut
protected function getComponentShortCut()
{
$data = array();
$app = $this->getApplication();
$db = $app->getModule('horuxDb')->DbConnection;
$db->Active = true;
$cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component' AND name!='tracking'");
$data_ = $cmd->query();
$data_ = $data_->readAll();
$isComponentHasOne = false;
foreach ($data_ as $d) {
$doc = new TXmlDocument();
$doc->loadFromFile('./protected/pages/components/' . $d['name'] . '/install.xml');
$name = $doc->getElementByTagName('name');
$installName = $doc->getElementByTagName('installName')->getValue();
$cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component' AND name='{$installName}'");
$data1 = $cmd->query();
$data1 = $data1->readAll();
foreach ($data1 as $d1) {
$cmd = $this->db->createCommand("SELECT * FROM hr_install AS i LEFT JOIN hr_component as c ON c.id_install=i.id WHERE i.type='component' AND c.parentmenu=0 AND i.id=" . $d1['id']);
$data2 = $cmd->query();
$data2 = $data2->read();
$url = "./themes/letux/images/header/icon-48-link.png";
if (!$isComponentHasOne) {
if ($this->isAccess($data2['page'])) {
$data[] = array('page' => $data2['page'], 'Name' => Prado::localize($name->getValue(), array(), $data2['name']), 'icon' => $url);
}
$isComponentHasOne = true;
} else {
if ($this->isAccess($data2['page'])) {
$data[] = array('page' => $data2['page'], 'Name' => Prado::localize($name->getValue(), array(), $data2['name']), 'icon' => $url);
}
}
$cmd = $this->db->createCommand("SELECT * FROM hr_install AS i LEFT JOIN hr_component as c ON c.id_install=i.id WHERE i.type='component' AND c.parentmenu=" . $data2['id'] . " AND c.parentmenu>0 AND i.id=" . $d1['id']);
$data2 = $cmd->query();
$data2 = $data2->readAll();
foreach ($data2 as $d2) {
if ($this->isAccess($d2['page'])) {
$pagePath = str_replace(".", "/", $d2['page']);
if (file_exists('./protected/pages/' . $pagePath . '.page')) {
$content = file_get_contents('./protected/pages/' . $pagePath . '.page');
if (preg_match("/IconAsset=\"<%~(.*)%>\"/", $content, $matches)) {
if (($assetPos = strrpos($matches[1], "assets/")) !== false) {
$icon = substr($matches[1], $assetPos + 7);
$icon = trim($icon);
if ($icon) {
$url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getApplication()->getBasePath() . '/pages/components/' . $d2['name'] . '/assets/' . $icon);
}
}
}
}
$data[] = array('page' => $d2['page'], 'Name' => Prado::localize($d2['menuname'], array(), $d2['name']), 'icon' => $url);
}
}
}
}
return $data;
}
示例10: init
public function init($config)
{
$request = Prado::getApplication()->getRequest();
if ($request->contains('pivotbar')) {
$this->type = TPropertyValue::ensureString($request['pivotbar']);
} else {
throw new TConfigurationException('You must specify the type of the graph');
}
if ($request->contains('numberpivots')) {
$this->numberpivots = TPropertyValue::ensureInteger($request['numberpivots']);
} else {
throw new TConfigurationException('You must calculate the number of base elements');
}
if ($request->contains('numberdimensions')) {
$this->numberdimensions = TPropertyValue::ensureInteger($request['numberdimensions']);
} else {
throw new TConfigurationException('You must calculate the number of dim elements');
}
if ($request->contains('numberchildren')) {
$this->numberchildren = TPropertyValue::ensureInteger($request['numberchildren']);
} else {
throw new TConfigurationException('You must calculate the number of children');
}
if ($request->contains('width')) {
$temp = explode(',', TPropertyValue::ensureInteger($request['width']));
$this->width = $temp[0];
}
if ($request->contains('height')) {
$temp = explode(',', TPropertyValue::ensureInteger($request['height']));
$this->height = $temp[0];
}
if ($request->contains('title')) {
$temp = explode(',', TPropertyValue::ensureString($request['title']));
$this->title = $temp[0];
}
if ($request->contains('legend')) {
$temp = explode(',', TPropertyValue::ensureString($request['legend']));
$this->legend = $temp[0];
}
if ($request->contains('xdata')) {
$this->xdata = explode(',', TPropertyValue::ensureString($request['xdata']));
} else {
throw new TConfigurationException('You must specify the x data for the graph');
}
for ($ii = 1; $ii <= $this->numberdimensions; $ii++) {
$variable = 'ydata' . $ii;
if ($request->contains($variable)) {
$this->ydata[$ii] = explode(',', TPropertyValue::ensureString($request[$variable]));
} else {
throw new TConfigurationException('You must specify the y data for the graph');
}
}
if ($request->contains('ytitle')) {
$this->ytitle = TPropertyValue::ensureString($request['ytitle']);
} else {
throw new TConfigurationException('You must specify the y title for the graph.');
}
}
示例11: _startThemeManager
private function _startThemeManager()
{
$themeManager = new TThemeManager();
$themeManager->BasePath = "System.Wsat.themes";
$url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat'));
$themeManager->BaseUrl = "{$url}/themes";
$themeManager->init(null);
$this->setThemeManager($themeManager);
}
示例12: loadFromFile
/**
* Parses the application configuration file.
* @param string configuration file name
* @throws TConfigurationException if there is any parsing error
*/
public function loadFromFile($fname)
{
if (Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) {
$fcontent = (include $fname);
$this->loadFromPhp($fcontent, dirname($fname));
} else {
$dom = new TXmlDocument();
$dom->loadFromFile($fname);
$this->loadFromXml($dom, dirname($fname));
}
}
示例13: onLoad
public function onLoad($param)
{
parent::onLoad($param);
$app = $this->getApplication();
$usedId = $app->getUser()->getUserID() == null ? 0 : $app->getUser()->getUserID();
$cmd = $this->db->createCommand("SELECT user_id FROM hr_superusers WHERE id={$usedId}");
$data = $cmd->query();
$dataUser = $data->read();
$this->userId = $dataUser['user_id'];
$this->employee = new employee($this->userId);
$this->tbb->setTitle(Prado::localize("My sign in/out") . " - " . $this->employee->getFullName());
if (!$this->IsPostBack) {
$cmd = $this->db->createCommand("SELECT t.date FROM hr_tracking AS t WHERE t.id_user=" . $this->userId . " ORDER BY t.date LIMIT 0,1");
$data = $cmd->query();
$data = $data->readAll();
$year = date("Y");
if (count($data) > 0) {
$year = explode("-", $data[0]['date']);
$year = $year[0];
}
$currentYear = date("Y");
$yearList = array();
for ($i = $year; $i <= $currentYear; $i++) {
$yearList[] = array('Value' => $i, 'Text' => $i);
}
$this->FilterYear->DataSource = $yearList;
$this->FilterYear->dataBind();
if (Prado::getApplication()->getSession()->contains($this->getApplication()->getService()->getRequestedPagePath() . 'FilterYear')) {
$FilterYear = $this->Session[$this->getApplication()->getService()->getRequestedPagePath() . 'FilterYear'];
$FilterMonth = $this->Session[$this->getApplication()->getService()->getRequestedPagePath() . 'FilterMonth'];
} else {
$FilterYear = date('Y');
$FilterMonth = date('n');
}
$FilterStatus = $this->Session[$this->getApplication()->getService()->getRequestedPagePath() . 'FilterStatus'];
if ($FilterStatus) {
$this->FilterStatus->setSelectedValue($FilterStatus);
}
if ($FilterYear) {
$this->FilterYear->setSelectedValue($FilterYear);
}
if ($FilterMonth) {
$this->FilterMonth->setSelectedValue($FilterMonth);
}
$this->DataGrid->DataSource = $this->Data;
$this->DataGrid->dataBind();
}
if (isset($this->Request['okMsg'])) {
$this->displayMessage($this->Request['okMsg'], true);
}
if (isset($this->Request['koMsg'])) {
$this->displayMessage($this->Request['koMsg'], false);
}
}
示例14: createDbConnection
/**
* Creates the DB connection.
* @param string the module ID for TDataSourceConfig
* @return TDbConnection the created DB connection
* @throws TConfigurationException if module ID is invalid or empty
*/
protected function createDbConnection($connectionID)
{
if ($connectionID !== '') {
$conn = Prado::getApplication()->getModule($connectionID);
if ($conn instanceof TDataSourceConfig) {
return $conn->getDbConnection();
} else {
throw new TConfigurationException('messagesource_connectionid_invalid', $connectionID);
}
} else {
throw new TConfigurationException('messagesource_connectionid_required');
}
}
示例15: onLoad
public function onLoad($param)
{
parent::onLoad($param);
if (!$this->isPostBack) {
$date = getDate();
if (Prado::getApplication()->getSession()->contains('nonWorkingDayYear')) {
$this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
$this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
} else {
$this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
$this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
}
}
}