public function editRow($sender, $param) { if ($this->IsValid) { $rows = new nNewsletterRecord(); $rows->Name = TPropertyValue::ensureString($this->Name->getSafeText()); $rows->Status = 0; $rows->save(); $lay = new nLayoutRecord(); //$lay->PlaneText = TPropertyValue::ensureString ( $this->PlaneText->getText () ); $lay->HtmlText = TPropertyValue::ensureString($this->HtmlText->getText()); $lay->nNewsletterID = $rows->ID; $lay->save(); $mailList = explode(";", $this->SendDescription->getText()); foreach ($mailList as $email) { if (filter_var(trim($email), FILTER_VALIDATE_EMAIL)) { if (!nSenderRecord::finder()->findBy_nLayoutID_AND_Email($lay->ID, trim($email))) { $send = new nSenderRecord(); $send->Email = trim($email); $send->Status = 0; $send->nLayoutID = $lay->ID; $send->save(); } } } $this->Response->redirect($this->Service->constructUrl("Newsletter.Data")); } }
public function editRow($sender, $param) { if ($this->IsValid) { $finder = CatalogueRecord::finder(); $finder->DbConnection->Active = true; $transaction = $finder->DbConnection->beginTransaction(); try { $rows = $finder->findBycat_id($this->getRequest()->itemAt("id")); $rows->MasterName = TPropertyValue::ensureString($this->Name->getSafeText()); $rows->ShortName = TPropertyValue::ensureString($this->ShortName->getSafeText()); $baseMethod = new BaseFunction(); $d = dir($baseMethod->UploadFilePath); while ($entry = $d->read()) { if (strlen($entry) > 2 && is_file($d->path . '/' . $entry) && $entry != '.htaccess') { copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Language/' . $this->getRequest()->itemAt("id") . '/' . $entry) or die("Błąd przy kopiowaniu"); $rows->Photo = $entry; } } $d->close(); $rows->save(); $transaction->commit(); $this->Response->redirect($this->Service->constructUrl("Language.Index", array("id" => $this->getRequest()->itemAt("id")))); } catch (Exception $e) { $transaction->rollBack(); } } }
private function createParameter($id, $value) { $element = new TXmlElement('parameter'); $element->Attributes['id'] = $id; $element->Attributes['value'] = TPropertyValue::ensureString($value); return $element; }
public function editRow($sender, $param) { if ($this->IsValid) { $short = strtolower($this->ShortName->getSafeText()); $rows = new CatalogueRecord(); $rows->name = 'messages.' . $short; $rows->MasterName = TPropertyValue::ensureString($this->Name->getSafeText()); $rows->ShortName = TPropertyValue::ensureString($short); $rows->save(); if (!is_dir(Prado::getPathOfAlias('UserFiles') . '/Language/' . $rows->cat_id)) { $dirun = dir(Prado::getPathOfAlias('UserFiles')); mkdir($dirun->path . '/Language/' . $rows->cat_id, 0775); $dirun->close(); } $baseMethod = new BaseFunction(); $d = dir($baseMethod->UploadFilePath); while ($entry = $d->read()) { if (strlen($entry) > 2 && is_file($d->path . '/' . $entry) && $entry != '.htaccess') { copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Language/' . $rows->cat_id . '/' . $entry) or die("Błąd przy kopiowaniu"); $row = CatalogueRecord::finder()->findBycat_id($rows->cat_id); $row->Photo = $entry; $row->save(); } } $statyczne = PagesRecord::finder()->findAll('PageID IS NULL AND LanguageID = 1'); foreach ($statyczne as $page) { $new = new PagesRecord(); $new->Name = $rows->ShortName . ' : ' . $page->Name; $new->LanguageID = $rows->cat_id; $new->LangCode = $short; $new->PageID = $page->PageID; $new->Protected = $page->Protected; $new->Position = $page->Position; $new->ShowMenu = $page->ShowMenu; $new->save(); } $translation = TransUnitRecord::finder()->findAll('cat_id = 1'); foreach ($translation as $page) { $new = new TransUnitRecord(); $new->id = $page->id; $new->cat_id = $rows->cat_id; $new->source = $page->source; $new->save(); } $settings = SettingsRecord::finder()->findAll('LanguageID = 1'); foreach ($settings as $set) { $newS = new SettingsRecord(); $newS->Key = $set->Key; $newS->Value = $rows->ShortName . ' : ' . $set->Value; $newS->LanguageID = $rows->cat_id; $newS->LangCode = $short; $newS->save(); } $this->Response->redirect($this->Service->constructUrl("Language.Index", array('id' => $rows->cat_id))); } }
/** * Constructor, similar to the parent constructor. For parameters that * are of SimpleXmlElement, the tag name and its attribute names and values * are expanded into a string. */ public function __construct($errorMessage) { $this->setErrorCode($errorMessage); $errorMessage = $this->translateErrorMessage($errorMessage); $args = func_get_args(); array_shift($args); $n = count($args); $tokens = array(); for ($i = 0; $i < $n; ++$i) { if ($args[$i] instanceof SimpleXmlElement) { $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); } else { $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); } } parent::__construct(strtr($errorMessage, $tokens)); }
public function init($config) { $request = Prado::getApplication()->getRequest(); if ($request->contains('graph')) { $this->type = TPropertyValue::ensureString($request['graph']); } else { throw new TConfigurationException('You must specify the type of the graph'); } 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( ',', ); $this->title = TPropertyValue::ensureString($request['title']); } if ($request->contains('legend')) { $this->legend = explode(',', TPropertyValue::ensureString($request['legend'])); } if ($request->contains('xdata')) { $this->xdata = explode(',', TPropertyValue::ensureString($request['xdata'])); } else { throw new TConfigurationException('You must specify the x data for the graph'); } if ($request->contains('ydata1')) { $this->ydata1 = explode(',', TPropertyValue::ensureString($request['ydata1'])); } else { throw new TConfigurationException('You must specify the y data for the graph'); } if ($request->contains('ydata2')) { $this->ydata2 = explode(',', TPropertyValue::ensureString($request['ydata2'])); } if ($request->contains('ytitle')) { $this->ytitle = TPropertyValue::ensureString($request['ytitle']); } else { throw new TConfigurationException('You must specify the y title for the graph.'); } }
public function changePassword2($sender, $param) { $finder = UserRecord::finder(); $finder->DbConnection->Active = true; $transaction = $finder->DbConnection->beginTransaction(); try { $baseMethod = new BaseFunction(); $hash = $this->getRequest()->itemAt("amp;hash"); if ($this->getRequest()->contains("amp;hash") == false) { $hash = $this->getRequest()->itemAt("hash"); } $rows = $finder->findByUsername($hash); $rows->Password = TPropertyValue::ensureString($baseMethod->cryptString($this->ConfirmPassword->getSafeText())); $rows->save(); $transaction->commit(); } catch (Exception $e) { print_R($e->getMessage()); $transaction->rollBack(); } $this->Response->redirect($this->Service->constructUrl("Login")); }
public function editRow($sender, $param) { if ($this->IsValid) { $rows = new SliderRecord(); $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($rows->ID); $rowPhoto->Photo = $namePhoto; $rowPhoto->save(); copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Slider/' . $namePhoto) or die("Błąd przy kopiowaniu"); } } $d->close(); $this->Response->redirect($this->Service->constructUrl("Slider.Index", array("id" => $rows->ID))); } }
/** * Sets the ID path of the {@link TTextBox} control. * The ID path is the dot-connected IDs of the controls reaching from * the keyboard's naming container to the target control. * @param string the ID path */ public function setForControl($value) { $this->setViewState('ForControl', TPropertyValue::ensureString($value)); }
/** * Formats the text value according to a format string. * If the format string is empty, the original value is converted into * a string and returned. * If the format string starts with '#', the string is treated as a PHP expression * within which the token '{0}' is translated with the data value to be formated. * Otherwise, the format string and the data value are passed * as the first and second parameters in {@link sprintf}. * @param string format string * @param mixed the data to be formatted * @return string the formatted result */ protected function formatDataValue($formatString, $value) { if ($formatString === '') { return TPropertyValue::ensureString($value); } else { if ($formatString[0] === '#') { $expression = strtr(substr($formatString, 1), array('{0}' => '$value')); try { if (eval("\$result={$expression};") === false) { throw new Exception(''); } return $result; } catch (Exception $e) { throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); } } else { return sprintf($formatString, $value); } } }
/** * @param string */ public function setDescription($value) { $this->setViewState('Description', TPropertyValue::ensureString($value), ''); }
/** * Set implementation class of ActiveRecordGateway * @param string $value */ public function setGatewayClass($value) { $this->_gatewayClass = TPropertyValue::ensureString($value); }
/** * Set the HTTP status code for the response. * The code and its reason will be sent to client using the currently requested http protocol version (see {@link THttpRequest::getHttpProtocolVersion}) * Keep in mind that HTTP/1.0 clients might not understand all status codes from HTTP/1.1 * * @param integer HTTP status code * @param string HTTP status reason, defaults to standard HTTP reasons */ public function setStatusCode($status, $reason = null) { if ($this->_httpHeaderSent) { throw new Exception('Unable to alter response as HTTP header already sent'); } $status = TPropertyValue::ensureInteger($status); if (isset(self::$HTTP_STATUS_CODES[$status])) { $this->_reason = self::$HTTP_STATUS_CODES[$status]; } else { if ($reason === null || $reason === '') { throw new TInvalidDataValueException("response_status_reason_missing"); } $reason = TPropertyValue::ensureString($reason); if (strpos($reason, "\r") != false || strpos($reason, "\n") != false) { throw new TInvalidDataValueException("response_status_reason_barchars"); } $this->_reason = $reason; } $this->_status = $status; }
/** * @param string the URL that the browser will be redirected to if the wizard finishes. */ public function setFinishDestinationUrl($value) { $this->setViewState('FinishDestinationUrl', TPropertyValue::ensureString($value), ''); }
/** * @param string hashing algorithm used to generate HMAC. */ public function setHashAlgorithm($value) { $this->_hashAlgorithm = TPropertyValue::ensureString($value); }
public function editRow($sender, $param) { if ($this->IsValid) { $finder = PagesRecord::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->ShortDescription = TPropertyValue::ensureString($this->ShortDescription->getText()); $rows->Seo = TPropertyValue::ensureString($this->Seo->getSafeText()); $rows->MetaKeywords = TPropertyValue::ensureString($this->MetaKeywords->getSafeText()); $rows->MetaDescription = TPropertyValue::ensureString($this->MetaDescription->getSafeText()); $rows->ShowDate = TPropertyValue::ensureString($this->ShowDate->getSafeText()); $rows->ShowDateDiff = strtotime($this->ShowDate->getSafeText()); $rows->PageID = $this->OtherPages->getData(); $rows->TitleDate = TPropertyValue::ensureString($this->TitleDate->getSafeText()); $rows->ShowMenu = $this->ShowMenu->getChecked(); $rows->ShowFooter = $this->ShowFooter->getChecked(); $rows->ShowHome = $this->ShowHome->getChecked(); if ($this->ShowHome->getChecked() == true) { $rows->HideDate = TPropertyValue::ensureString($this->HideDate->getSafeText()); $rows->HideDateDiff = strtotime($this->HideDate->getSafeText()); } else { $rows->HideDate = null; $rows->HideDateDiff = 0; } $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); $row = new FilesRecord(); $row->Name = $namePhoto; $row->IsParent = 0; if (FilesRecord::finder()->count('PagesID = ? AND IsParent = 1', $this->getRequest()->itemAt("id")) == 0) { $row->IsParent = 1; } $row->Position = 999; //$row->PagesID = $this->getRequest ()->itemAt ( "id" ); $row->save(); copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $this->getRequest()->itemAt("id") . '/' . $namePhoto) or die("Błąd przy kopiowaniu"); $baseMethod->createThumb($namePhoto, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $this->getRequest()->itemAt("id") . '/', $baseMethod->GlobalWidth); } } $d->close(); $transaction->commit(); $this->Response->redirect($this->Service->constructUrl("Pages.Index", array("id" => $this->getRequest()->itemAt("id")))); } catch (Exception $e) { $transaction->rollBack(); print_r($e); echo 'a'; die; } } }
/** * @param string Google Maps API Key. * Visit http://www.google.com/apis/maps/signup.html to get an API Key for your domain. */ public function setApiKey($value) { $this->_apiKey = TPropertyValue::ensureString($value); }
/** * @return string word or token separators (delimiters). */ public function setSeparator($value) { $this->setViewState('tokens', TPropertyValue::ensureString($value), ''); }
/** * @param string value of the item */ public function setValue($value) { $this->_value = TPropertyValue::ensureString($value); }
/** * Finds the lowest cardinal index of the item whose text is the one being looked for. * @param string the text to be looked for * @param boolean whether to look for disabled items also * @return integer the index of the item found, -1 if not found. */ public function findIndexByText($text, $includeDisabled = true) { $text = TPropertyValue::ensureString($text); $index = 0; foreach ($this as $item) { if ($item->getText() === $text && ($includeDisabled || $item->getEnabled())) { return $index; } $index++; } return -1; }
public function setIActCss($value) { $this->setViewState('IActCss', TPropertyValue::ensureString($value), ''); }
/** * @param string */ public function setFillspace($value) { $this->setViewState('Fillspace', TPropertyValue::ensureString($value), '_'); }
/** * Sets the PHP expression to be evaluated for conditionally displaying content. * The context of the expression is the template control containing TConditional. * @param string the PHP expression used for determining which template to use. */ public function setCondition($value) { $this->_condition = TPropertyValue::ensureString($value); }
/** * @param string Command name associated to the menu item */ public function setCommandName($value) { $this->_commandName = TPropertyValue::ensureString($value); }
/** * Sets the text content to be displayed on this view. * If this is not empty, the child content of the view will be ignored. * @param string the text content displayed on this view */ public function setText($value) { $this->setViewState('Text', TPropertyValue::ensureString($value), ''); }
public function setYLabel($value) { $this->ylabel = TPropertyValue::ensureString($value); }
public function setCacheKey($value) { $this->_cacheKey = TPropertyValue::ensureString($value); }
/** * Sets the ID path of the CAPTCHA control to validate. * The ID path is the dot-connected IDs of the controls reaching from * the validator's naming container to the target control. * @param string the ID path */ public function setCaptchaControl($value) { $this->setViewState('CaptchaControl', TPropertyValue::ensureString($value), ''); }
/** * Set the handle id or css class * @param string */ public function setHandle($value) { $this->setViewState('DragHandle', TPropertyValue::ensureString($value), null); }
/** * @param string default scaffold stylesheet name */ public function setDefaultStyle($value) { $this->setViewState('DefaultStyle', TPropertyValue::ensureString($value), 'style'); }