示例#1
0
 /**
  *
  * get film by id
  * @param $id
  * @return array
  */
 public function getFilmById($id)
 {
     $result = $this->db->query("SELECT * FROM films WHERE Film_Id= :Film_Id;", $para = ["Film_Id" => $id]);
     $fileName = $this->getFilmsName($result);
     $fo = new FileOperation();
     foreach ($fileName as $value) {
         $fileArray = $fo->parseInfo($value);
         $filmDescription[] = $fileArray[0];
         $filmClickRate[] = $fileArray[1];
         $result->filmDiscription = $filmDescription;
         $result->filmClickRate = $filmClickRate;
     }
     $filmsInfo = [];
     foreach ($result->rows as $row) {
         if (is_array($row)) {
             $film = new stdClass();
             foreach ($row as $key => $value) {
                 $film->{$key} = $value;
             }
             $filmsInfo[] = $film;
         }
     }
     for ($i = 0; $i < count($result->filmDiscription); $i++) {
         $filmsInfo[$i]->filmDisc = $result->filmDiscription[$i];
     }
     for ($i = 0; $i < count($result->filmClickRate); $i++) {
         $filmsInfo[$i]->filmClickNum = (int) $result->filmClickRate[$i];
     }
     return $filmsInfo;
 }
示例#2
0
 public function aTag($tag, $attributes, $content, $Attrval)
 {
     try {
         /*Validate all input values */
         $this->ValidateUserInput($tag, $attributes, $content);
         /*Special Tag Img*/
         if ($tag == 'img') {
             /*check for image file exists */
             $file = new FileOperation();
             try {
                 $file->isFileExists($Attrval);
             } catch (FileNotFoundException $e) {
                 $attributes = 'alt';
                 $Attrval = "No image";
             }
         }
         $html = '<' . $tag;
         $html .= ' ' . $attributes . '="' . $Attrval . '"';
         $html .= '>' . $content . "</" . $tag . "><br>\n";
         /*Display Created Tag*/
         echo "\nTag Created :" . $html . '<br>';
     } catch (InvalidAttributeException $e) {
         echo 'Invalid Attribute.';
     } catch (InvalidContentException $e) {
         echo 'Invalid Content.';
     } catch (InvalidTagNameException $e) {
         echo 'Invalid Tag Name.';
     }
 }
示例#3
0
 public function clickNumber($filename)
 {
     $fo = new FileOperation();
     $file = "./files/" . $filename . ".txt";
     $fileArray = $fo->parseInfo($file);
     // trim($fileArray[1]);
     // var_dump($fileArray[1]);
     $fileArray[1]++;
     $fileInfo = $fileArray[0] . "[movie-hit]:" . $fileArray[1];
     $fo->writeFile($file, $fileInfo);
     //var_dump($fileArray[1]);
 }
示例#4
0
 public function __construct()
 {
     if (empty($_GET["FileName"])) {
         echo 'Please Enter file name to check.<br>';
     } else {
         $fileop = new FileOperation();
         $this->thisdir = getcwd();
         $path = $this->thisdir . '\\' . $_GET["FileName"];
         try {
             $fileop->isFileExists($path);
             $fileop->readFileintoArray($path);
             $fileop->readLineByLineFromFile($path);
             $fileop->AppendtoFile($path);
             $fileop->DelelteFile($_GET["DelFile"]);
             $fileop->getAllfilesFromDirectory($_GET["DirName"]);
             $fileop->CreateDirectory($_GET["NewDirName"]);
             $fileop->ReadCSVFile($path);
             $fileop->readXMLFile($path);
         } catch (FileNotFoundException $e) {
             echo 'Severe Error Occured : File not Found.';
         } catch (FileLoadException $e) {
             echo 'Error in loading file..';
         } catch (DirectoryExistsException $e) {
             echo 'Directory already exists..';
         } catch (FileAlreadyExistsException $e) {
             echo 'File already exists..';
         } catch (FileNotReadble $e) {
             echo 'File is not readble..';
         } catch (FileAlreadyExistsException $e) {
             echo 'File is not writable...';
         } catch (GeneralException $e) {
             echo 'Error occured in Processing request...';
         } catch (DirectoryNotFoundException $e) {
             echo 'Directory not found..';
         }
     }
 }
 public function __construct()
 {
     parent::__construct();
 }
 /**
  * Creates a save file operation
  * @param WebApi $webapi The WebApi
  * @param string $getFileUrl The URL of the GetFile-Handler
  * @param Connection $connection The connection settings to the CRM-VISIONLINE system
  * @param int $bufferSize The buffer size for file operations
  * @param string $directory The directory to which to save the file
  * @param bool $forceDownload Specifies whether the file should be downloaded, even if it exists and is not outdated.
  */
 public function __construct(WebApi $webapi, $getFileUrl, Connection $connection, $bufferSize, $directory, $forceDownload)
 {
     parent::__construct($webapi, $getFileUrl, $connection, $bufferSize);
     $this->directory = $directory;
     $this->forceDownload = $forceDownload;
 }
 /**
  * Creates a FilePassthruOperation
  * @param WebApi $webapi The WebApi
  * @param string $getFileUrl The URL of the GetFile-Handler
  * @param Connection $connection The connection settings to the CRM-VISIONLINE system
  * @param int $bufferSize The buffer size for file operations
  * @param bool $sendHeaders Indicates whether headers should be sent
  * @param bool $attachment Indicates whether the Content-disposition header should be set to 'attachment'
  */
 public function __construct(WebApi $webapi, $getFileUrl, Connection $connection, $bufferSize, $sendHeaders, $attachment)
 {
     parent::__construct($webapi, $getFileUrl, $connection, $bufferSize);
     $this->sendHeaders = $sendHeaders;
     $this->attachment = $attachment;
 }
 /**
  * Create a get file operation
  * @param WebApi $webapi The WebApi
  * @param string $getFileUrl The URL of the GetFile-Handler
  * @param Connection $connection The connection settings to the CRM-VISIONLINE system
  * @param int $bufferSize The buffer size for file operations
  */
 public function __construct(WebApi $webapi, $getFileUrl, Connection $connection, $bufferSize)
 {
     parent::__construct($webapi, $getFileUrl, $connection, $bufferSize);
 }