Пример #1
0
 protected function _getContent($jobId, $contentStatus = 1)
 {
     try {
         $stmt = Zend_Registry::get('dbh')->proc('get_content_by_jobid');
         $stmt->bindParam(':id', $jobId, PDO::PARAM_INT);
         $stmt->bindParam(':status', $contentStatus, PDO::PARAM_INT);
         try {
             $stmt->execute();
             $content = $stmt->fetchall(PDO::FETCH_OBJ);
             $stmt->closeCursor();
         } catch (Zend_Db_Statement_Exception $e) {
             die($e->getMessage());
         }
     } catch (Zend_Db_Statement_Exception $e) {
         die(__LINE__ . ':' . __FILE__ . ':' . $e->getMessage());
     }
     $image = Zend_Controller_Action_HelperBroker::getStaticHelper('MediaImage');
     $media = Zend_Controller_Action_HelperBroker::getStaticHelper('Media');
     $article = Zend_Controller_Action_HelperBroker::getStaticHelper('Article');
     $status = Zend_Controller_Action_HelperBroker::getStaticHelper('Status');
     $numConts = count($content) - 1;
     for ($i = 0; $i <= $numConts; $i++) {
         $content[$i]->image = $image->direct($content[$i]->image);
         $content[$i]->media = $media->direct($content[$i]->id);
         $content[$i]->article = $article->getArticle($content[$i]->article);
         $content[$i]->status = $status->getStatus($content[$i]->status);
         $content[$i] = Showcase_Content::factory($content[$i]);
     }
     return $content;
 }
Пример #2
0
 protected function _factory($type, $userId, $userIp, $cache = true, $preview = null, $portals = null, $channels = null, $seriesId = null, $offset = 0, $limit = null, Zend_Date $start = null, Zend_Date $finish = null, $showId = null, $exclude = null, $searchTerm = null, $searchFilter = null, $transcript = null)
 {
     $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS, true, false);
     $userIp = $validator->isValid($userIp) ? $userIp : null;
     unset($validator);
     $start = $start ? strval($start) : null;
     $finish = $finish ? strval($finish) : null;
     $stmt = Zend_Registry::get('dbh')->proc('page_content_load');
     $stmt->bindParam(':preview', $preview, PDO::PARAM_INT);
     $stmt->bindParam(':portals', $portals, PDO::PARAM_INT);
     $stmt->bindParam(':channels', $channels, PDO::PARAM_INT);
     /*
     $stmt->bindParam(':series', $seriesId, PDO::PARAM_INT);
     $stmt->bindParam(':exclude', $exclude, PDO::PARAM_INT);
     $stmt->bindParam(':show', $showId, PDO::PARAM_STR);
     $stmt->bindParam(':start', $start, PDO::PARAM_STR);
     $stmt->bindParam(':finish', $finish, PDO::PARAM_STR);		
     $stmt->bindParam(':search', $searchTerm, PDO::PARAM_STR);
     $stmt->bindParam(':filter', $searchFilter, PDO::PARAM_STR);
     $stmt->bindParam(':user', $user->id, PDO::PARAM_INT);
     $stmt->bindParam(':ip', $userIp, PDO::PARAM_STR);
     $stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
     $stmt->bindParam(':limit', $limit, PDO::PARAM_INT);
     $stmt->bindParam(':type', $type, PDO::PARAM_STR);
     */
     $results = array();
     try {
         $stmt->execute();
         $pageContent = array();
         $rowCount = 0;
         do {
             $results[] = $stmt->fetchAll(Zend_Db::FETCH_OBJ);
         } while ($stmt->nextRowset());
         $stmt->closeCursor();
     } catch (Zend_Db_Statement_Exception $e) {
         if ('HYC00' == $stmt->errorCode()) {
             $results[] = $stmt->fetchAll(Zend_Db::FETCH_OBJ);
         }
     }
     foreach ($results as $rowset) {
         foreach ($rowset as $row) {
             if (isset($row->found_rows)) {
                 $rowCount = $row->found_rows;
                 continue;
             } else {
                 $pageContent[] = Showcase_Content::factory($row, $cache);
             }
         }
     }
     $binds = array($user->id, $userIp, $offset, $limit, $type, $portals, $channels, $seriesId, $exclude, $showId, $start, $finish, $searchTerm, $searchFilter, $preview);
     //print_r($binds);
     //print_r($results);
     //echo "CALL page_content_load(".implode($binds,',').")";
     return array('contents' => $showId ? $pageContent[0] : $pageContent, 'rows' => !$rowCount ? count($pageContent) : $rowCount);
 }