protected function GetShareDetails() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Sharedetails()->ReturnDate)); if ($objClause = $this->dtrShareDetails->LimitClause) { array_push($objClauses, $this->dtrShareDetails->LimitClause); } if ($this->txtSearchTerm->Text == "") { $objCondition = QQ::Equal(QQN::Sharedetails()->Owner, $_SESSION['User']); $myassets = Sharedetails::QueryArray($objCondition, $objClauses); } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Sharedetails()->Asin, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Email, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->TakenDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->ReturnDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->FullName, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Sharedetails::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; } //$this->dtrShareDetails->TotalItemCount = Sharedetails::QueryCount($condition); $this->arrShareDetails = $myassets; return $objCondition; }
protected function LendBasket() { foreach ($this->objBasket->GetBasket() as $item) { $objItem = Myassets::QuerySingle(QQ::Equal(QQN::Myassets()->Id, $item->Id)); $objPerson = Peopledetails::QuerySingle(QQ::Equal(QQN::Peopledetails()->Id, $this->strBorrower)); $objShareDetails = new Sharedetails(); $objShareDetails->Asin = $objItem->Asin; $objShareDetails->Email = $objPerson->Email; /*Logic to get the return date*/ $today = new QDateTime(QDateTime::Now); $daySpan = new QDateTimeSpan(); $daySpan->AddDays(30); $returnDate = $today->Add($daySpan); $objShareDetails->TakenDate = QDateTime::Now(false); $objShareDetails->ReturnDate = $returnDate; $objShareDetails->Title = $objItem->Title; $objShareDetails->FullName = $objPerson->FullName; $objShareDetails->Save(); } }
/** * Load a single Myassets object, * by Id Index(es) * @param integer $intId * @return Myassets */ public static function LoadById($intId) { return Myassets::QuerySingle(QQ::Equal(QQN::Myassets()->Id, $intId)); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Myassets-based QQNode. * It will also verify that it is a proper Myassets-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'myassets') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "myassets".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::Myassets()->Id; case 'Asin': return QQN::Myassets()->Asin; case 'DetailPageURL': return QQN::Myassets()->DetailPageURL; case 'Title': return QQN::Myassets()->Title; case 'ProductGroup': return QQN::Myassets()->ProductGroup; case 'ImageURL': return QQN::Myassets()->ImageURL; case 'Author': return QQN::Myassets()->Author; case 'NumberOfPages': return QQN::Myassets()->NumberOfPages; case 'Publisher': return QQN::Myassets()->Publisher; case 'Isbn': return QQN::Myassets()->Isbn; case 'Actor': return QQN::Myassets()->Actor; case 'Director': return QQN::Myassets()->Director; case 'RunningTime': return QQN::Myassets()->RunningTime; case 'Artist': return QQN::Myassets()->Artist; case 'Label': return QQN::Myassets()->Label; case 'NumberOfDiscs': return QQN::Myassets()->NumberOfDiscs; case 'Tracks': return QQN::Myassets()->Tracks; case 'Language': return QQN::Myassets()->Language; case 'Genre': return QQN::Myassets()->Genre; case 'Owner': return QQN::Myassets()->Owner; default: throw new QCallerException('Simple Property not found in MyassetsDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }
<?php include_once 'prepend.inc.php'; $cndASIN = QQ::AndCondition(QQ::Equal(QQN::Myassets()->Asin, $_ITEM->ASIN), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $cndTitle = QQ::AndCondition(QQ::Equal(QQN::Myassets()->Title, $_ITEM->ASIN), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $cntASIN = Myassets::QueryCount($cndASIN); $cntTitle = Myassets::QueryCount($cndTitle); if ($cntASIN != 0 || $cntTitle != 0) { $owned = true; } else { $owned = false; } ?> <table> <tr> <td><?php try { if (isset($_ITEM->MediumImage->Url)) { $img = $_ITEM->MediumImage->Url; } else { $img = '../assets/images/48x48/help.png'; } } catch (Exception $e) { $img = '../../assets/images/48x48/help.png'; } ?> <img src='<?php _p($img); ?> ' width=108px height=160px></img></td> <td>
private function GetAssetsData($productgroup) { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Myassets()->Title)); if ($objClause = $this->dtrMyLibrary->LimitClause) { array_push($objClauses, $this->dtrMyLibrary->LimitClause); } if ($this->txtSearchTerm->Text == "") { $condition = QQ::AndCondition(QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $arrResult = Myassets::QueryArray($condition, $objClauses); $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($condition); $this->dtrMyLibrary->DataSource = $arrResult; } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Myassets()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Author, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Artist, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Actor, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Director, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Publisher, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Label, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Myassets()->Isbn, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->ProductGroup, $productgroup), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Myassets::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; $this->dtrMyLibrary->TotalItemCount = Myassets::QueryCount($objCondition); if ($this->dtrMyLibrary->TotalItemCount > 0) { $this->dtrMyLibrary->DataSource = $myassets; } else { QApplicationBase::DisplayAlert('No ' . $productgroup . 's exists for the searched term'); } } }