Пример #1
0
 /**
  * Given a Temp File Path, this will save the database record AND copy the file at the temporary file path
  * to the file assets directory for headshots
  * @param string $strTempFilePath
  * @return void
  */
 public function SaveHeadShot($strTempFilePath)
 {
     // Figure out the Image Type
     $mixImageInfo = getimagesize($strTempFilePath);
     switch ($mixImageInfo['mime']) {
         case 'image/gif':
             $this->intImageTypeId = ImageType::gif;
             break;
         case 'image/jpeg':
             $this->intImageTypeId = ImageType::jpg;
             break;
         case 'image/png':
             $this->intImageTypeId = ImageType::png;
             break;
         default:
             throw new QCallerException('Image Type Not Supported: ' . $mixImageInfo['mime']);
     }
     // Start the Transaction
     HeadShot::GetDatabase()->TransactionBegin();
     // Save the DB Record, Make Folders (if appicable) and Save the File
     $this->Save();
     QApplication::MakeDirectory($this->Folder, 0777);
     copy($strTempFilePath, $this->Path);
     chmod($this->Path, 0777);
     // Commit the Transaction
     HeadShot::GetDatabase()->TransactionCommit();
 }
Пример #2
0
 /**
  * Gets the historical journal for an object from the log database.
  * Objects will have VirtualAttributes available to lookup login, date, and action information from the journal object.
  * @param integer intId
  * @return HeadShot[]
  */
 public static function GetJournalForId($intId)
 {
     $objDatabase = HeadShot::GetDatabase()->JournalingDatabase;
     $objResult = $objDatabase->Query('SELECT * FROM head_shot WHERE id = ' . $objDatabase->SqlVariable($intId) . ' ORDER BY __sys_date');
     return HeadShot::InstantiateDbResult($objResult);
 }