public function __construct($objParentObject, $strControlId = null) { parent::__construct($objParentObject, $strControlId); $this->blnAutoRenderChildren = true; $this->strTemplate = dirname(__FILE__) . '/' . __CLASS__ . '.tpl.php'; $this->txtSearch = new QTextBox($this); $this->txtSearch->Name = t('Text'); $this->txtSearch->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'txtSearch_KeyUp')); $this->txtSearch->SetCustomAttribute('autocomplete', 'off'); $this->btnClear = new QImageButton($this); $this->btnClear->AlternateText = t('Clear'); $this->btnClear->ToolTip = $this->btnClear->AlternateText; $this->btnClear->CssClass = 'clear_button'; $this->btnClear->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/clear.png'; $this->btnClear->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnClear_Click')); $this->lstLanguage = new QListBox($this); $arrLanguages = NarroLanguage::LoadAllActive(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)); foreach ($arrLanguages as $objLanguage) { $this->lstLanguage->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageId, $objLanguage->LanguageCode == QApplication::$TargetLanguage->LanguageCode); } $this->btnSearch = new QImageButton($this); $this->btnSearch->AlternateText = t('Search'); $this->btnSearch->ToolTip = $this->btnSearch->AlternateText; $this->btnSearch->CssClass = 'clear_button'; $this->btnSearch->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/search.png'; $this->btnSearch->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'txtSearch_KeyUp')); $this->dtgSuggestion = new NarroSuggestionDataGrid($this); $this->dtgSuggestion->ShowHeader = false; $this->dtgSuggestion->MetaAddColumn(QQN::NarroSuggestion()->SuggestionValue); $this->dtgSuggestion->AdditionalClauses = array(QQ::LimitInfo(20), QQ::OrderBy(QQN::NarroSuggestion()->Text->TextCharCount)); $this->btnClear_Click(); }
/** * @return WpPosts|null The WpPosts object, that is a copy of this DLE post. */ public function LoadWpPosts() { $objWpUsers = $this->LoadWpUser(); if (!$objWpUsers) { return null; } return WpPosts::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPosts()->PostAuthor, $objWpUsers->Id), QQ::Equal(QQN::WpPosts()->PostDate, $this->Date), QQ::Equal(QQN::WpPosts()->PostName, $this->AltName)), QQ::Clause(QQ::LimitInfo(1))); }
public function RefreshStats() { $this->intPackageCount = $this->CountPackages(); $objPackage = Package::QuerySingle(QQ::Equal(QQN::Package()->PackageCategoryId, $this->intId), QQ::Clause(QQ::LimitInfo(1), QQ::OrderBy(QQN::Package()->LastPostDate, false))); if ($objPackage && $objPackage->LastPostDate) { $this->dttLastPostDate = new QDateTime($objPackage->LastPostDate); } else { $this->dttLastPostDate = null; } $this->Save(); }
/** * This will refresh all the stats (last post date, message/topic counts) and save the record to the database * @return void */ public function RefreshStats() { $objMessage = Message::QuerySingle(QQ::Equal(QQN::Message()->TopicLinkId, $this->intId), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(1))); if ($objMessage) { $this->dttLastPostDate = $objMessage->PostDate; } else { $this->dttLastPostDate = null; } $this->intMessageCount = Message::CountByTopicLinkId($this->intId); $this->intTopicCount = Topic::CountByTopicLinkId($this->intId); $this->Save(); }
/** * @return WpComments|null The Worpress comment for this DLE comment. */ public function LoadWpComments() { $objWpPosts = $this->LoadWpPosts(); if (!$objWpPosts) { return null; } $objWpUsers = $this->LoadWpUsers(); $conUsersCondition = QQ::Equal(QQN::WpComments()->CommentAuthorEmail, $this->Email); if ($objWpUsers) { $conUsersCondition = QQ::Equal(QQN::WpComments()->UserId, $objWpUsers->Id); } return WpComments::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpComments()->CommentPostID, $objWpPosts->Id), $conUsersCondition, QQ::Equal(QQN::WpComments()->CommentDate, $this->Date), QQ::Equal(QQN::WpComments()->CommentContent, str_replace('\\"', '"', $this->Text))), QQ::Clause(QQ::OrderBy(QQN::WpComments()->CommentID), QQ::LimitInfo(1))); }
/** * Load a single AssetTransactionCheckout object, * by AssetId * @param integer $intAssetId * @return object $objAssetTransactionCheckout */ public function LoadAssetTransactionCheckoutByAssetId($intAssetId = null) { // Loads objAssetTransaction $objClauses = array(); $objOrderByClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false); $objLimitClause = QQ::LimitInfo(1, 0); array_push($objClauses, $objOrderByClause); array_push($objClauses, $objLimitClause); $AssetTransactionArray = AssetTransaction::LoadArrayByAssetId($this->AssetId, $objClauses); $intLastAssetTransactionId = $AssetTransactionArray[0]->AssetTransactionId; $objAssetTransactionCheckout = AssetTransactionCheckout::LoadByAssetTransactionId($intAssetLastTransactionId); return $objAssetTransactionCheckout; }
/** * @return mixed[] The array of DB ORM objects to process. * @param int $intOffset The offset means already processed objects exclusion. */ protected function get_objects_array($intOffset) { return WpTermTaxonomy::LoadAll(QQ::Clause(QQ::LimitInfo(10, $intOffset), QQ::OrderBy(QQN::WpTermTaxonomy()->TermTaxonomyId))); }
protected function Form_Create() { parent::Form_Create(); $this->objBlogTopicArray = Topic::QueryArray(QQ::Equal(QQN::Topic()->TopicLink->ForumId, 5), QQ::Clause(QQ::OrderBy(QQN::Topic()->Id, false), QQ::LimitInfo(4))); }
/** * Gets the most recently updated or uploaded contribution * @return PackageContribution */ public function GetMostRecentContribution() { return PackageContribution::QuerySingle(QQ::Equal(QQN::PackageContribution()->PackageId, $this->intId), QQ::Clause(QQ::OrderBy(QQN::PackageContribution()->CurrentPostDate, false), QQ::LimitInfo(1))); }
protected function GetSugestionArray() { $this->arrSuggestion = NarroSuggestion::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->Text->NarroContextAsText->FileId, $this->objFile->FileId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->objTargetLanguage->LanguageId)), array(QQ::Expand(QQN::NarroSuggestion()->User), QQ::Expand(QQN::NarroSuggestion()->Text), QQ::LimitInfo(500, 0))); }
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once dirname(__FILE__) . '/configuration/prepend.inc.php'; if (isset($argv[0])) { $intCnt = 0; $intSkipped = 0; foreach (NarroSuggestion::QueryArray(QQ::AndCondition(QQ::NotEqual(QQN::NarroSuggestion()->UserId, 0), QQ::LessThan(QQN::NarroSuggestion()->SuggestionWordCount, 1)), array(QQ::OrderBy(QQN::NarroSuggestion()->SuggestionId, 0), QQ::LimitInfo(10000, 0))) as $intVal => $objSuggestion) { if ($objSuggestion->SuggestionValueMd5 != md5($objSuggestion->SuggestionValue)) { $intSkipped++; continue; } try { $objSuggestion->SaveWordCount(); $intCnt++; } catch (Exception $objEx) { echo $objEx->getMessage(); } } printf("Skipped %d, saved %d suggestions, last suggestion id is %d\n", $intSkipped, $intCnt, $objSuggestion->SuggestionId); die; } // if (QApplication::HasPermission('Administrator')) {
<?php // Up the Memory Limit ini_set('memory_limit', '256M'); // Ensure we are NOT running QApplication::CliProcessEnsureUnique(); // Setup a Lock File QApplication::CliProcessSetupLockFile(); // Run the Logic/Code while (QApplication::CliProcessIsLockFileValid()) { // Analyze only 10 at a time, starting with the oldest (E.g. lowest ID) first $objMessageArray = OutgoingEmailQueue::LoadArrayByErrorFlag(false, array(QQ::OrderBy(QQN::OutgoingEmailQueue()->Id), QQ::LimitInfo(10))); foreach ($objMessageArray as $objMessage) { // Send up to 100 at a time for any given EmailMessage $objMessage->Send(); } sleep(10); }
/** * Respond to a data request and return the data object * Will include row id and row class if those are provided. * @param string $strFormId * @param string $strControlId * @param string $strParameter */ public function _GetAjaxData($strFormId, $strControlId, $strParameter) { $this->objOrderByClause = null; $this->intDrawCount = null; $data = $strParameter; // Set limit info for partial data requests if (isset($data['start']) && isset($data['length']) && $data['length'] != '-1') { $this->intDisplayStart = QType::Cast($data['start'], QType::Integer); $this->intPageLength = QType::Cast($data['length'], QType::Integer); $this->objLimitInfo = QQ::LimitInfo($this->intPageLength, $this->intDisplayStart); } if (isset($data['order'])) { $sortCols = $data['order']; $intSortColsCount = count($sortCols); // We only support ordering by one column at this point //for ($i = 0; $i < $intSortColsCount; $i++) { $i = 0; $intSortColIdx = QType::Cast($sortCols[$i]['column'], QType::Integer); $objColumn = $this->GetColumn($intSortColIdx); $strSortDir = QType::Cast($sortCols[$i]['dir'], QType::String); if (strtolower($strSortDir) == 'desc') { if ($objColumn->ReverseOrderByClause) { $this->objOrderByClause = $objColumn->ReverseOrderByClause; } } else { if ($objColumn->OrderByClause) { $this->objOrderByClause = $objColumn->OrderByClause; } } // Save so that if table is redrawn, order will be preserved. $this->arrOrder = []; $this->arrOrder[] = [$intSortColIdx, $strSortDir]; //} } if (isset($data['search']['value'])) { // TODO: Support RegEx searching. Will require implementing regex in database adapters. Will take work. if (!is_array($this->mixSearch)) { $this->mixSearch = []; } $this->mixSearch['search'] = QType::Cast($data['search']['value'], QType::String); } // If column level searching is enabled, save off values $this->arrSearchCols = null; if (!empty($data['columns'])) { $this->arrSearchCols = []; foreach ($data['columns'] as $key => $values) { if (!empty($values['searchable'])) { $this->arrSearchCols[$key]['search'] = $values['search']['value']; // TODO: Deal with the regex flag } else { $this->arrSearchCols[$key]['search'] = null; } } } if (isset($data['draw'])) { $this->intDrawCount = QType::Cast($data['draw'], QType::Integer); } // Get the data and send it back to the control if (!is_null($this->intDrawCount)) { // Required drawing count, aids in helping control keep track of ajax responses $this->DataBind(); $mixDataArray = array(); if ($this->objDataSource) { $rowIndex = 0; if (isset($intOffset)) { $rowIndex = $intOffset; } foreach ($this->objDataSource as $objObject) { $row = $this->AjaxGetRowData($objObject, $rowIndex); $rowIndex++; $mixDataArray[] = $row; } } $filteredCount = $this->mixSearch ? $this->FilteredItemCount : $this->TotalItemCount; if (!$filteredCount || $filteredCount < count($mixDataArray)) { $filteredCount = count($mixDataArray); } $output = array("draw" => $this->intDrawCount, "recordsTotal" => $this->TotalItemCount, "recordsFiltered" => $filteredCount, "data" => $mixDataArray); $output = JavaScriptHelper::toJsObject($output); $strJS = sprintf('$j("#%s").data("dtResponse")(%s);', $this->ControlId, $output); QApplication::ExecuteJavaScript($strJS, QJsPriority::Exclusive); $this->objDataSource = null; $this->intDrawCount = null; } }
public function txtSearch_Autocomplete() { $arrReturn = array(); $arrConditions = array(QQ::Like(QQN::NarroProject()->ProjectName, '%' . $this->txtSearch->Text . '%')); if (!QApplication::HasPermission('Administrator')) { $arrConditions[] = QQ::Equal(QQN::NarroProject()->Active, true); } foreach (NarroProject::QueryArray(QQ::AndCondition($arrConditions), array(QQ::LimitInfo(10, 0))) as $objProject) { $arrReturn[] = $objProject->ProjectName; } $this->txtSearch->DataSource = $arrReturn; }
public function LoadFirst() { return self::QuerySingle(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::WpUsers()->Id), QQ::LimitInfo(1))); }
/** * @return WpUsers The Wordpress user for this DLE user. */ public function LoadWpUsers() { return WpUsers::QuerySingle(QQ::Equal(QQN::WpUsers()->UserEmail, $this->Email), QQ::Clause(QQ::LimitInfo(1))); }
<?php require '../../includes/prepend.inc.php'; $objRss = new QRssFeed('Qcodo.com RSS Feed', 'http://www.qcodo.com/', 'The Qcodo Development Framework is an open-source PHP framework that focuses on freeing developers from unnecessary tedious, mundane coding. ' . 'This RSS feed reports on the most recent activity, posts and community contributions to the framework via the Qcodo.com website.'); $objRss->Image = new QRssImage('http://www.qcodo.com/images/qcodo_smaller.png'); $objRss->PubDate = new QDateTime(QDateTime::Now); $objMessageArray = Message::QueryArray(QQ::Equal(QQN::Message()->Topic->TopicLink->TopicLinkTypeId, TopicLinkType::Forum), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(25))); $objMessageArray = Message::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(25))); foreach ($objMessageArray as $objMessage) { $objTopic = $objMessage->Topic; $strTitle = ($objTopic->CountMessages() > 1 ? 'Re: ' : '') . $objTopic->Name; $strLink = 'http://www.qcodo.com' . $objTopic->LinkLastPage; $strDescription = $objMessage->CompiledHtml; switch ($objTopic->TopicLink->TopicLinkTypeId) { case TopicLinkType::Forum: $strTitle = '[Forums] ' . $strTitle; break; case TopicLinkType::Issue: $strTitle = '[Issue] ' . $strTitle; break; case TopicLinkType::Package: $strTitle = '[QPM] ' . $strTitle; break; case TopicLinkType::WikiItem: $strTitle = '[Wiki] ' . $strTitle; break; } $objItem = new QRssItem($strTitle, $strLink, $strDescription); $objItem->Author = $objMessage->Person ? $objMessage->Person->DisplayName : 'Qcodo System Message'; $objItem->Comments = $objItem->Link; $objItem->PubDate = $objMessage->PostDate;
/** * This will send this message in PendingSend status, given a limit of how many to send out. * It will first attempt to send bounces... then it will send actuals (up to the limit) * per token. * * If all OutgoingMessageQueus are exhuasted for this EmailMessage, then this EmailMessage * status will be set to Completed, CompletedWithSomeRejections or Rejected * @return void */ public function SendMessage($intMaxPerEmail) { // First process errors $objToSend = EmailOutgoingQueue::LoadArrayByEmailMessageIdErrorFlag($this->intId, true); foreach ($objToSend as $objEmailOutgoingQueue) { $objSmtpMessage = new QEmailMessage(GROUPS_SERVER_BOUNCE_EMAIL, $objEmailOutgoingQueue->ToAddress, GROUPS_SERVER_BOUNCE_SUBJECT, $this->ErrorMessage . "\r\n\r\n----- Original message -----\r\n\r\n" . $this->strRawMessage); QEmailServer::Send($objSmtpMessage); $objEmailOutgoingQueue->Delete(); } // Second process successes $this->GetHeaderArray(); $this->ClearHeaderValue('Subject'); $this->ClearHeaderValue('Message-Id'); $this->ClearHeaderValue('Message-ID'); $this->ClearHeaderValue('Message-id'); $this->ClearHeaderValue('message-id'); $this->ClearHeaderValue('MESSAGE-ID'); foreach ($this->GetEmailMessageRouteArray() as $objRoute) { $objToSend = EmailOutgoingQueue::LoadArrayByEmailMessageIdToken($this->Id, $objRoute->Token, QQ::LimitInfo($intMaxPerEmail)); if (count($objToSend)) { $strHeaderArray = $this->strHeaderArray; $strSubject = $this->Subject; if (strpos(strtolower($strSubject), '[' . trim(strtolower($objRoute->Name)) . ']') === false) { $strSubject = '[' . trim($objRoute->Name) . '] ' . $strSubject; } $strHeaderArray['Subject'] = $strSubject; //GJS - add a Reply-To in the header $strHeaderArray['Reply-To'] = $this->FromAddress; $strRcptToArray = array(); foreach ($objToSend as $objEmailOutgoingQueue) { if (QEmailServer::IsEmailValid($objEmailOutgoingQueue->ToAddress)) { $strRcptToArray[] = $objEmailOutgoingQueue->ToAddress; } } // GJS - Ensure that From address is the email of the group instead. This is to get around new email policies. // $this->FromAddress $txtFromAddress = "{$this->FromAddress}"; // default if we can't extract the group name; if ($this->_EmailMessageRoute) { if ($this->_EmailMessageRoute->CommunicationList) { $txtFromAddress = $this->_EmailMessageRoute->CommunicationList->Token . 'groups.alcf.net'; } else { if ($this->_EmailMessageRoute->Group->Token) { $txtFromAddress = $this->_EmailMessageRoute->Group->Token . 'groups.alcf.net'; } } } QEmailServer::SendRawMessage($txtFromAddress, $strRcptToArray, $strHeaderArray, $this->ResponseBody); foreach ($objToSend as $objEmailOutgoingQueue) { $objEmailOutgoingQueue->Delete(); } } } // Finally, update status (if applicable) if (!$this->CountEmailOutgoingQueues()) { if ($this->CountEmailMessageRoutes() && $this->ErrorMessage) { $this->intEmailMessageStatusTypeId = EmailMessageStatusType::CompletedWithSomeRejections; } else { if ($this->CountEmailMessageRoutes()) { $this->intEmailMessageStatusTypeId = EmailMessageStatusType::Completed; } else { $this->intEmailMessageStatusTypeId = EmailMessageStatusType::Rejected; } } $this->Save(); } }
<?php QEmailServer::$SmtpServer = SMTP_SERVER; QEmailServer::$SmtpPort = SMTP_PORT; QEmailServer::$SmtpUsername = SMTP_USERNAME; QEmailServer::$SmtpPassword = SMTP_PASSWORD; QEmailServer::$AuthLogin = true; $objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::LimitInfo(50))); foreach ($objEmailQueue as $objEmail) { $objEmail->Send(); }
<?php require_once '../qcubed.inc.php'; // Setup the Feed, itself $objRss = new QRssFeed('Examples Site Projects', 'http://examples.qcu.be/', 'An Example RSS feed of the Qcubed Examples Site Projects'); $objRss->Image = new QRssImage('http://www.qcu.be/sites/all/themes/qcubednew/images/QCubed.png'); $objRss->PubDate = new QDateTime(QDateTime::Now); // Iterate through all the projects, and setup a QRssItem per project // Limit it to the "10 most recently started projects" foreach ($objProjects = Project::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Project()->StartDate, false), QQ::LimitInfo(10))) as $objProject) { $objItem = new QRssItem($objProject->Name, 'http://examples.qcu.be/examples/communication/rss.php/' . $objProject->Id, $objProject->Description); $objItem->Author = $objProject->ManagerPerson->FirstName . ' ' . $objProject->ManagerPerson->LastName; $objItem->PubDate = $objProject->StartDate; $objItem->Guid = $objItem->Link; $objItem->GuidPermaLink = true; $objItem->AddCategory(new QRssCategory('Some Project Category 1')); $objItem->AddCategory(new QRssCategory('Some Project Category 2')); $objRss->AddItem($objItem); } // Output/Run the feed // Note that the Run method will reset the output buffer and setup the Headers to output XML, // so any HTML or Text outputted until now will be lost. If for whatever reason you just // want the XML, you can call $objRss->GetXml(), which will return the XML string. // Also, if you need to change the encoding of the XML, you can do so in QApplication::$EncodingType. $objRss->Run();
As a final reminder, note that you can use either, both, more or none of these optional <b>QQClause</b> parameters whenever you make your <b>LoadAll</b> or <b>LoadArrayBy</b> calls. </div> <h3>List All the People, Ordered by Last Name then First Name</h3> <?php // Load the Person array, sorted $objPersonArray = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); foreach ($objPersonArray as $objPerson) { _p($objPerson->LastName . ', ' . $objPerson->FirstName . ' (ID #' . $objPerson->Id . ')'); _p('<br/>', false); } ?> <h3>List Five People, Start with the Third from the Top, Ordered by Last Name then First Name</h3> <?php // Load the Person array, sorted and limited // Note that because we want to start with row #3, we need to define "2" as the offset $objPersonArray = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::LimitInfo(5, 2))); foreach ($objPersonArray as $objPerson) { _p($objPerson->LastName . ', ' . $objPerson->FirstName . ' (ID #' . $objPerson->Id . ')'); _p('<br/>', false); } ?> <?php require '../includes/footer.inc.php';
<?php QEmailServer::$SmtpServer = SMTP_SERVER; QEmailServer::$OriginatingServerIp = SMTP_EHLO; QEmailServer::$TestMode = SMTP_TEST_MODE; $objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::OrderBy(QQN::EmailQueue()->HighPriorityFlag, false), QQ::LimitInfo(50))); foreach ($objEmailQueue as $objEmail) { $objEmail->Send(); }
<div id="demoZone"> <h2>Select all People, Ordered by Last Name then First Name</h2> <p><em>Note now QQ::OrderBy gets two parameters here</em></p> <ul> <?php $objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false); } ?> </ul> <h2>Select all People, Ordered by Last Name then First Name, Limited to the first 4 results</h2> <p><em>Combining QQ::OrderBy and QQ::LimitInfo</em></p> <ul> <?php $objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::LimitInfo(4))); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false); } ?> </ul> <h2>Select all People, those with last name Smith first, then ordered by First Name</h2> <p><em>Using a QQ::Condition as an ORDER BY clause</em></p> <ul> <?php $objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQ::NotEqual(QQN::Person()->LastName, 'Smith'), QQN::Person()->FirstName))); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false); } ?> </ul>
/** * Returns a Location object from the most recent shipment transaction for this asset * * @return Object Location */ public function GetLastShippedFromLocation() { $objCondition = QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $this->AssetId), QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6)); $objClauses = array(); $objExpansionClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation); $objOrderByClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false); $objLimitClause = QQ::LimitInfo(1, 0); array_push($objClauses, $objExpansionClause); array_push($objClauses, $objOrderByClause); array_push($objClauses, $objLimitClause); $AssetTransactionArray = AssetTransaction::QueryArray($objCondition, $objClauses); if (count($AssetTransactionArray) > 0) { $Location = $AssetTransactionArray[0]->SourceLocation; } else { $Location = null; } return $Location; }
public static function RegisterUser($strUsername, $strEmail, $strPassword, $strRealName) { $objMaxUser = NarroUser::LoadAll(QQ::Clause(QQ::LimitInfo(1, 0), QQ::OrderBy(QQN::NarroUser()->UserId, false))); $objUser = new NarroUser(); $objUser->UserId = $objMaxUser[0]->UserId + 1; $objUser->Username = $strUsername; if ($strRealName) { $objUser->RealName = $strRealName; } $objUser->Email = $strEmail; require_once __NARRO_INCLUDES__ . '/PasswordHash.class.php'; $objHasher = new PasswordHash(8, FALSE); $objUser->Password = $objHasher->HashPassword($strPassword); try { $objUser->Save(); } catch (Exception $objEx) { throw $objEx; } /** * set up default roles */ $objUserRole = new NarroUserRole(); if ($objUser->UserId == 1) { $objUserRole->RoleId = 5; } else { $objUserRole->RoleId = 2; } $objUserRole->UserId = $objUser->UserId; $objUserRole->Save(); return NarroUser::LoadByUsernameAndPassword($strUsername, md5($strPassword)); }
/** * Returns the HTML needed for a receipt datagrid to show asset and inventory icons, with hovertips. * * @param QDatagrid Object $objControl * @return string */ public function __toStringHoverTips($objControl) { // Create the Asset Image label, with corresponding assets hovertip if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory || $this->Transaction->EntityQtypeId == EntityQtype::Asset) { $lblAssetImage = new QLabelExt($objControl); $lblAssetImage->HtmlEntities = false; $lblAssetImage->Text = sprintf('<img src="%s/icons/asset_datagrid.png" style="vertical-align:middle;">', __IMAGE_ASSETS__); // create $objHoverTip = new QHoverTip($lblAssetImage); $objHoverTip->Template = __DOCROOT__ . __SUBDIRECTORY__ . '/receiving/hovertip_assets.tpl.php'; $lblAssetImage->HoverTip = $objHoverTip; // Load the AssetTransaction Array on the form so that it can be used by the hovertip panel $objClauses = array(); if ($objClause = QQ::LimitInfo(11, 0)) { array_push($objClauses, $objClause); } if ($objClause = QQ::Expand(QQN::AssetTransaction()->Asset->AssetModel)) { array_push($objClauses, $objClause); } if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) { } array_push($objClauses, $objClause); $objControl->Form->objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($this->TransactionId, $objClauses); $objClauses = null; } // Create the Inventory Image label with corresponding inventory hovertip if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory || $this->Transaction->EntityQtypeId == EntityQtype::Inventory) { $lblInventoryImage = new QLabelExt($objControl); $lblInventoryImage->HtmlEntities = false; $lblInventoryImage->Text = sprintf('<img src="%s/icons/inventory_datagrid.png" style="vertical-align:middle;"', __IMAGE_ASSETS__); // Create the inventory hovertip $objHoverTip = new QHoverTip($lblInventoryImage); $objHoverTip->Template = __DOCROOT__ . __SUBDIRECTORY__ . '/receiving/hovertip_inventory.tpl.php'; $lblInventoryImage->HoverTip = $objHoverTip; // Load the InventoryTransaction Array on the form so that it can be used by the hovertip panel $objClauses = array(); if ($objClause = QQ::LimitInfo(11, 0)) { array_push($objClauses, $objClause); } if ($objClause = QQ::Expand(QQN::InventoryTransaction()->InventoryLocation->InventoryModel)) { } array_push($objClauses, $objClause); $objControl->Form->objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($this->TransactionId, $objClauses); $objClauses = null; } // Display the appropriate images if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory) { $strToReturn = $lblAssetImage->Render(false) . ' ' . $lblInventoryImage->Render(false); } elseif ($this->Transaction->EntityQtypeId == EntityQtype::Asset) { $strToReturn = $lblAssetImage->Render(false); } elseif ($this->Transaction->EntityQtypeId == EntityQtype::Inventory) { $strToReturn = $lblInventoryImage->Render(false); } return $strToReturn; }
<?php // Up the Memory Limit ini_set('memory_limit', '1024M'); // Ensure we are NOT running QApplication::CliProcessEnsureUnique(); // Setup a Lock File QApplication::CliProcessSetupLockFile(); // Run the Logic/Code while (QApplication::CliProcessIsLockFileValid()) { // Analyze only 10 at a time, starting with the oldest (E.g. lowest ID) first $objMessageArray = EmailMessage::LoadArrayByEmailMessageStatusTypeId(EmailMessageStatusType::NotYetAnalyzed, array(QQ::OrderBy(QQN::EmailMessage()->Id), QQ::LimitInfo(10))); foreach ($objMessageArray as $objMessage) { $objMessage->AnalyzeMessage(); } sleep(10); }
protected function Form_PreRender() { // If an existing InventoryModel is being edited, render the Quantities by Location and Transaction history datagrids if ($this->ctlInventoryEdit->blnEditMode) { // Render the Quantities by Location datagrid $objExpansionMap[InventoryLocation::ExpandLocation] = true; $this->ctlInventoryEdit->dtgInventoryQuantities->TotalItemCount = InventoryLocation::CountByInventoryModelIdLocations($this->ctlInventoryEdit->objInventoryModel->InventoryModelId); // If there are no rows in the datagrid, do not show the header column if ($this->ctlInventoryEdit->dtgInventoryQuantities->TotalItemCount == 0) { $this->ctlInventoryEdit->dtgInventoryQuantities->ShowHeader = false; } else { $this->ctlInventoryEdit->dtgInventoryQuantities->ShowHeader = true; // $this->ctlInventoryEdit->dtgInventoryQuantities->DataSource = InventoryLocation::LoadArrayByInventoryModelId($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, $this->ctlInventoryEdit->dtgInventoryQuantities->SortInfo, $this->ctlInventoryEdit->dtgInventoryQuantities->LimitInfo, $objExpansionMap); $this->ctlInventoryEdit->dtgInventoryQuantities->DataSource = InventoryLocation::LoadArrayByInventoryModelIdLocations($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, $this->ctlInventoryEdit->dtgInventoryQuantities->SortInfo, $this->ctlInventoryEdit->dtgInventoryQuantities->LimitInfo, $objExpansionMap); } $this->ctlInventoryEdit->dtgInventoryDateQuantities->TotalItemCount = SkuDateQtyHistory::CountBySku($this->ctlInventoryEdit->objInventoryModel->InventoryModelCode); if ($this->ctlInventoryEdit->dtgInventoryDateQuantities->TotalItemCount == 0) { $this->ctlInventoryEdit->dtgInventoryDateQuantities->ShowHeader = false; } else { $this->ctlInventoryEdit->dtgInventoryDateQuantities->ShowHeader = true; $tmp = explode(",", $this->ctlInventoryEdit->dtgInventoryDateQuantities->LimitInfo); $this->ctlInventoryEdit->dtgInventoryDateQuantities->DataSource = SkuDateQtyHistory::LoadArrayBySku($this->ctlInventoryEdit->objInventoryModel->InventoryModelCode, QQ::Clause(QQ::OrderBy(QQN::SkuDateQtyHistory()->Date, false), QQ::LimitInfo($tmp[1], $tmp[0]))); //print_r($this->ctlInventoryEdit->dtgInventoryDateQuantities->DataSource); } $objExpansionMap = null; // Specify the local databind method this datagrid will use $this->ctlInventoryEdit->dtgInventoryTransaction->SetDataBinder('dtgInventoryTransaction_Bind'); // Specify the local databind method this datagrid will use $this->ctlInventoryEdit->dtgShipmentReceipt->SetDataBinder('dtgShipmentReceipt_Bind'); } // If InventoryLocations are in the array, finish setting up the datagrid of InventorieLocations prepared for a transaction if ($this->ctlInventoryTransact->objInventoryLocationArray) { // Using the array instead of querying the database again. This means sorting will not work because the db is not being queried each time. $this->ctlInventoryTransact->dtgInventoryTransact->TotalItemCount = count($this->ctlInventoryTransact->objInventoryLocationArray); $this->ctlInventoryTransact->dtgInventoryTransact->DataSource = $this->ctlInventoryTransact->objInventoryLocationArray; $this->ctlInventoryTransact->dtgInventoryTransact->ShowHeader = true; } else { $this->ctlInventoryTransact->dtgInventoryTransact->TotalItemCount = 0; $this->ctlInventoryTransact->dtgInventoryTransact->ShowHeader = false; } }
public function __get($strName) { switch ($strName) { // APPEARANCE case "Noun": return $this->strNoun; case "NounPlural": return $this->strNounPlural; // BEHAVIOR // BEHAVIOR case "Paginator": return $this->objPaginator; case "PaginatorAlternate": return $this->objPaginatorAlternate; case "UseAjax": return $this->blnUseAjax; case "ItemsPerPage": if ($this->objPaginator) { return $this->objPaginator->ItemsPerPage; } else { return null; } case "TotalItemCount": if ($this->objPaginator) { return $this->objPaginator->TotalItemCount; } else { return null; } // MISC // MISC case "DataSource": return $this->objDataSource; case "LimitClause": if ($this->objPaginator) { if ($this->objPaginator->TotalItemCount > 0) { $intOffset = ($this->objPaginator->PageNumber - 1) * $this->objPaginator->ItemsPerPage; return QQ::LimitInfo($this->objPaginator->ItemsPerPage, $intOffset); } } return null; case "LimitInfo": if ($this->objPaginator) { if ($this->objPaginator->TotalItemCount > 0) { $intOffset = ($this->objPaginator->PageNumber - 1) * $this->objPaginator->ItemsPerPage; return $intOffset . ',' . $this->objPaginator->ItemsPerPage; } } return null; case "ItemCount": return count($this->objDataSource); case 'PageNumber': if ($this->objPaginator) { return $this->objPaginator->PageNumber; } else { return null; } default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * @return mixed[] The array of DB ORM objects to process. * @param int $intOffset The offset means already processed objects exclusion. */ protected function get_objects_array($intOffset) { return DlePost::LoadAll(QQ::Clause(QQ::LimitInfo(10, $intOffset), QQ::OrderBy(QQN::DlePost()->Id))); }