本文整理汇总了PHP中Prado类的典型用法代码示例。如果您正苦于以下问题:PHP Prado类的具体用法?PHP Prado怎么用?PHP Prado使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Prado类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
function setup()
{
parent::setup();
$app = Prado::getApplication();
$this->userDao = $app->getModule('daos')->getDao('UserDao');
$this->flushDatabase();
}
示例2: onLoad
public function onLoad($param)
{
$this->Page->Title = Prado::localize('NewCustomer');
$this->content->Visible = true;
$this->reg_ok->Visible = false;
$this->Save->ImageUrl = $this->Page->Theme->BaseUrl . '/images/' . $this->getApplication()->getGlobalization()->Culture . '/save.gif';
$this->btnCancelSelect->ImageUrl = $this->Page->Theme->BaseUrl . '/images/' . $this->getApplication()->getGlobalization()->Culture . '/cancel.gif';
if (isset($_GET["status"])) {
$this->content->Visible = false;
$this->reg_ok->Visible = true;
}
if ($this->User->UserDB->type_user_id == 4) {
$this->Save->Visible = false;
$this->btnCancelSelect->Visible = false;
} else {
$this->Save->Visible = true;
$this->btnCancelSelect->Visible = true;
}
$criteria = new TActiveRecordCriteria();
$criteria->OrdersBy['id'] = 'desc';
$classifiche = TblClassifica::finder()->findAll($criteria);
$this->DDLClassifica->DataSource = $classifiche;
$this->DDLClassifica->dataBind();
$this->DDLClassifica->SelectedValue = 1;
}
示例3: getCache
protected function getCache()
{
if (!$this->_cache) {
$this->_cache = Prado::getApplication()->getCache();
}
return $this->_cache;
}
示例4: run
/**
* Runs the service.
* This method is invoked by application automatically.
*/
public function run()
{
$id = $this->getRequest()->getServiceParameter();
if (isset($this->_feeds[$id])) {
$feedConfig = $this->_feeds[$id];
$properties = $feedConfig->getAttributes();
if (($class = $properties->remove('class')) !== null) {
$feed = Prado::createComponent($class);
if ($feed instanceof IFeedContentProvider) {
// init feed properties
foreach ($properties as $name => $value) {
$feed->setSubproperty($name, $value);
}
$feed->init($feedConfig);
$content = $feed->getFeedContent();
//$this->getResponse()->setContentType('application/rss+xml');
$this->getResponse()->setContentType($feed->getContentType());
$this->getResponse()->write($content);
} else {
throw new TConfigurationException('feedservice_feedtype_invalid', $id);
}
} else {
throw new TConfigurationException('feedservice_class_required', $id);
}
} else {
throw new THttpException(404, 'feedservice_feed_unknown', $id);
}
}
示例5: getDecorator
/**
* @return TWebControlDecorator
*/
public function getDecorator($create = true)
{
if ($create && !$this->_decorator) {
$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
}
return $this->_decorator;
}
示例6: getData
protected function getData()
{
$d = array();
$cmd = $this->db->createCommand("SELECT * FROM hr_config WHERE id=1");
$query = $cmd->query();
$data = $query->read();
$dir = $data['log_path'];
if (file_exists($dir)) {
if (!is_readable($dir)) {
$this->displayMessage(Prado::localize('The directory {dir} is not readable', array("dir" => $dir)), false);
return false;
}
} else {
$this->displayMessage(Prado::localize('The directory {dir} does not exist', array("dir" => $dir)), false);
return false;
}
$list = scandir($dir);
$i = 0;
foreach ($list as $l) {
if ($l != "." && $l != "..") {
$d[$i]['Value'] = "./horuxlog/" . $l;
$d[$i++]['Text'] = $l;
}
}
return $d;
}
示例7: insertBrick
function insertBrick($sender, $param)
{
$x = Prado::createComponent("Application.pages.LTemplate");
$x->Size = $sender->NamingContainer->findControl("MySize")->SelectedValue;
$this->placeholder->getControls()->add($x);
$this->Page->CallbackClient->insertContentAfter($this->AjaxInsertPoint, $x);
}
示例8: displayHardwareList
public function displayHardwareList()
{
$path = './protected/pages/hardware/device/';
$files = scandir($path);
$types = array();
foreach ($files as $f) {
if ($f != '..' && $f != '.' && $f != '.svn' && is_dir($path . $f)) {
$t = explode("_", $f);
$type = $t;
unset($type[0]);
$types[$t[0]][] = implode("_", $type);
}
}
$html = '<ul id="menu-item" class="jtree">';
foreach ($types as $k => $v) {
$html .= '<li id="internal-node">';
$html .= '<div class="node-open"><span></span>';
$html .= Prado::localize("{type} technology", array('type' => $k));
$html .= '</div><ul>';
foreach ($v as $k2 => $v2) {
$html .= '<li>';
$html .= '<div class="leaf"><span></span>';
$html .= '<a href="' . $this->Service->constructUrl('hardware.device.' . $k . '_' . $v2 . '.add') . '">' . $v2 . '</a>';
$html .= '</div>';
$html .= '</li>';
}
$html .= '</ul>';
$html .= '</li>';
}
$html .= '</ul>';
return $html;
}
示例9: onLoad
public function onLoad($param)
{
$this->Page->Title = Prado::localize('Confirm');
$id = 0;
$code = "";
if (isset($_GET["id"])) {
$id = $_GET["id"];
}
if (isset($_GET["code"])) {
$code = $_GET["code"];
}
if ($id != 0 && $code != "") {
$user = TblUsers::finder()->findBy_id($id);
if ($user != null) {
if ($user->active == 1) {
$this->result->Text = Prado::localize('USER_ALREADY_ACTIVE') . " <a href='mailto:" . $this->Application->Parameters['EMAIL_ASSISTENZE'] . "'>" . Prado::localize('ASSISTENZE') . "</a>";
} else {
if ($user->confirm_code != $code) {
$this->result->Text = Prado::localize('USER_WRONG_CODE') . " <a href='mailto:" . $this->Application->Parameters['EMAIL_ASSISTENZE'] . "'>" . Prado::localize('ASSISTENZE') . "</a>";
} else {
$user->active = 1;
$user->save();
$this->result->Text = Prado::localize('ACTIVATION_OK');
}
}
} else {
$this->result->Text = Prado::localize('USER_NOT_EXIST') . " <a href='mailto:" . $this->Application->Parameters['EMAIL_ASSISTENZE'] . "'>" . Prado::localize('ASSISTENZE') . "</a>";
}
} else {
}
}
示例10: getThumbnailGenerator
protected function getThumbnailGenerator()
{
if (is_null($this->_thumbnailGen)) {
$this->_thumbnailGen = Prado::createComponent($this->getThumbnailGeneratorClass());
}
return $this->_thumbnailGen;
}
示例11: editRow
public function editRow($sender, $param)
{
if ($this->IsValid) {
$finder = SliderRecord::finder();
$finder->DbConnection->Active = true;
$transaction = $finder->DbConnection->beginTransaction();
try {
$rows = $finder->findByID($this->getRequest()->itemAt("id"));
$rows->Name = TPropertyValue::ensureString($this->Name->getSafeText());
$rows->Description = TPropertyValue::ensureString($this->Description->getText());
$rows->save();
$baseMethod = new BaseFunction();
$d = dir($baseMethod->UploadFilePath);
while ($entry = $d->read()) {
if (strlen($entry) > 2 && is_file($d->path . '/' . $entry) && $entry != '.htaccess') {
$namePhoto = strtolower($entry);
$rowPhoto = SliderRecord::finder()->findByID($this->getRequest()->itemAt("id"));
$rowPhoto->Photo = $namePhoto;
$rowPhoto->save();
copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Slider/' . $namePhoto) or die("Błąd przy kopiowaniu");
}
}
$d->close();
$transaction->commit();
$this->Response->redirect($this->Service->constructUrl("Slider.Index", array("id" => $this->getRequest()->itemAt("id"))));
} catch (Exception $e) {
$transaction->rollBack();
die;
}
}
}
示例12: createInstanceOf
/**
* Creates a new instance of a particular class (for PHP primative types,
* their corresponding default value for given type is used).
* @param string PHP type name
* @return mixed default type value, if no type is specified null is returned.
* @throws TSqlMapException if class name is not found.
*/
public function createInstanceOf($type = '')
{
if (strlen($type) > 0) {
switch (strtolower($type)) {
case 'string':
return '';
case 'array':
return array();
case 'float':
case 'double':
case 'decimal':
return 0.0;
case 'integer':
case 'int':
return 0;
case 'bool':
case 'boolean':
return false;
}
if (class_exists('Prado', false)) {
return Prado::createComponent($type);
} else {
if (class_exists($type, false)) {
//NO auto loading
return new $type();
} else {
throw new TSqlMapException('sqlmap_unable_to_find_class', $type);
}
}
}
}
示例13: 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();
}
示例14: onDefault
public function onDefault($sender, $param)
{
$cbs = $this->findControlsByType("TActiveCheckBox");
$nDelete = 0;
$koMsg = '';
$cbChecked = 0;
foreach ($cbs as $cb) {
if ((bool) $cb->getChecked() && $cb->Value != "0") {
$cbChecked++;
}
}
if ($cbChecked == 0) {
$koMsg = Prado::localize('Select one item');
} elseif ($cbChecked == 1) {
foreach ($cbs as $cb) {
if ((bool) $cb->getChecked() && $cb->Value != "0") {
$cmd = $this->db->createCommand("UPDATE hr_install SET `default`='0' WHERE type='template'");
$cmd->execute();
$cmd = $this->db->createCommand("UPDATE hr_install SET `default`='1' WHERE id=:id");
$cmd->bindValue(":id", $cb->Value);
$cmd->execute();
}
}
} else {
$koMsg = Prado::localize('Select only one item');
}
if ($koMsg !== '') {
$pBack = array('koMsg' => $koMsg);
} else {
$pBack = array('okMsg' => Prado::localize('New default template updated'));
}
$this->Response->redirect($this->Service->constructUrl('installation.template', $pBack));
}
示例15: rollback
/**
* Rolls back a transaction.
* @throws TDbException if the transaction or the DB connection is not active.
*/
public function rollback()
{
if ($this->_compatible) {
$this->getConnection()->setForceMaster(TMasterSlaveDbConnectionForceMaster::OFF_AUTOMATIC);
}
Prado::log('rollback, ForceMaster: OFF_AUTOMATIC', TLogger::DEBUG, 'System.Testing.Data.Distributed.MasterSlave.TMasterSlaveDbTransaction');
parent::rollback();
}