Esempio n. 1
0
 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();
     }
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this MyassetsMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Myassets object creation - defaults to CreateOrEdit
  * @return MyassetsMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objMyassets = Myassets::Load($intId);
         // Myassets was found -- return it!
         if ($objMyassets) {
             return new MyassetsMetaControl($objParentObject, $objMyassets);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Myassets object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new MyassetsMetaControl($objParentObject, new Myassets());
 }
Esempio n. 3
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, Myassets::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Default / simple DataBinder for this Meta DataGrid.  This can easily be overridden
  * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  */
 public function MetaDataBinder()
 {
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = Myassets::CountAll();
     }
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Myassets, given the clauses above
     $this->DataSource = Myassets::LoadAll($objClauses);
 }
Esempio n. 5
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objMember) {
         $objObject->objMember = Memberdetails::GetSoapObjectFromObject($objObject->objMember, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intMemberId = null;
         }
     }
     if ($objObject->objAsset) {
         $objObject->objAsset = Myassets::GetSoapObjectFromObject($objObject->objAsset, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intAssetId = null;
         }
     }
     return $objObject;
 }
Esempio n. 6
0
<?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>
Esempio n. 7
0
 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');
         }
     }
 }
 /**
  * Refresh this MetaControl with Data from the local MemberAsset object.
  * @param boolean $blnReload reload MemberAsset from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objMemberAsset->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objMemberAsset->Id;
         }
     }
     if ($this->lstMember) {
         $this->lstMember->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstMember->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objMemberArray = Memberdetails::LoadAll();
         if ($objMemberArray) {
             foreach ($objMemberArray as $objMember) {
                 $objListItem = new QListItem($objMember->__toString(), $objMember->Id);
                 if ($this->objMemberAsset->Member && $this->objMemberAsset->Member->Id == $objMember->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstMember->AddItem($objListItem);
             }
         }
     }
     if ($this->lblMemberId) {
         $this->lblMemberId->Text = $this->objMemberAsset->Member ? $this->objMemberAsset->Member->__toString() : null;
     }
     if ($this->lstAsset) {
         $this->lstAsset->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstAsset->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objAssetArray = Myassets::LoadAll();
         if ($objAssetArray) {
             foreach ($objAssetArray as $objAsset) {
                 $objListItem = new QListItem($objAsset->__toString(), $objAsset->Id);
                 if ($this->objMemberAsset->Asset && $this->objMemberAsset->Asset->Id == $objAsset->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAsset->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAssetId) {
         $this->lblAssetId->Text = $this->objMemberAsset->Asset ? $this->objMemberAsset->Asset->__toString() : null;
     }
 }