Пример #1
0
 public function actionVastXml($vid)
 {
     echo header('Content-Type: application/xml');
     echo '<?xml version="1.0" encoding="UTF-8"?>';
     $xml .= '<VAST version="2.0">';
     $Data = VastVideo::model()->findBySQL('' . 'SELECT r.vast_id, r.vast_title, r.vast_link, r.vast_source, r.vast_views ' . 'FROM videocms_video AS v ' . 'INNER JOIN videocms_category AS c ' . 'ON v.video_category = c.id ' . 'INNER JOIN videocms_vast AS r ' . 'ON FIND_IN_SET(c.id, r.vast_video_cat) ' . 'WHERE r.vast_start < NOW() ' . 'AND r.vast_end > NOW() ' . 'AND r.vast_published = "1" ' . 'AND v.video_id = :IdVideo ' . 'ORDER BY RAND() ' . 'LIMIT 1', array(':IdVideo' => $vid));
     VastVideo::model()->updateByPk($Data->vast_id, array('vast_views' => $Data->vast_views + 1));
     if (!$Data->vast_id == NULL) {
         $xmlok = '<MediaFile delivery="progressive" bitrate="400" width="320" height="180" type="video/mp4"><![CDATA[' . $Data->vast_source . ']]></MediaFile>';
     }
     $xml .= '<Ad id="' . $Data->vast_id . '">
             <id>' . $Data->vast_id . '</id>
             <InLine>
             <Creatives>
             <Creative sequence="' . $Data->vast_title . '" id="">
             <Linear>
             <Duration>00:00:31</Duration>
             <VideoClicks>
             <ClickThrough><![CDATA[http://' . $Data->vast_link . ']]></ClickThrough>
             </VideoClicks>
             <MediaFiles>
             ' . $xmlok . '
             </MediaFiles>
             </Linear>
             </Creative>
             </Creatives>
             </InLine>
             </Ad>';
     $xml .= '</VAST>';
     echo $xml;
 }
Пример #2
0
 public function actionVastUpdate($id)
 {
     $this->pageTitle = 'Edit Vast';
     if (!is_numeric($id)) {
         exit;
     }
     $VastUpdate = false;
     $ModelVast = VastVideo::model()->findByPk($id);
     if (isset($_POST['VastVideo'])) {
         $ModelVast->attributes = $_POST['VastVideo'];
         if ($ModelVast->validate()) {
             $ModelVast->vast_video_cat = implode(',', $ModelVast->video_category);
             $ModelVast->save();
             $VastUpdate = true;
         }
         $this->redirect(array('/admin/vast'));
     }
     $this->render('vastupdate', array('ModelVast' => $ModelVast, 'VastUpdate' => $VastUpdate));
 }