--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/thd/apps/frontend/modules/editor/actions/segmentListJsonAction.class.php Tue Sep 22 16:40:38 2009 +0200
@@ -0,0 +1,35 @@
+<?php
+
+class segmentListJsonAction extends sfAction
+{
+ public function execute($request)
+ {
+ header("Content-type: text/x-json");
+ $segments = '';
+ $this->ref = $this->getRequestParameter('ref');
+ $this->film_slug = $this->getRequestParameter('film_slug');
+
+ // Get File segmentation Path
+ $this->path = sfConfig::get('app_storage_uploads');
+ $this->format = sfConfig::get('app_storage_format');
+ $file = $this->path.$this->ref."_".$this->film_slug.$this->format;
+
+
+ //Check if file exist
+ if (file_exists($file)) {
+ $fp = fopen($file, "r");
+ while (($data = fgetcsv($fp)) != FALSE) {
+ $line = "{sin: " . $data[0] .
+ ",sout: " . $data[1] .
+ ",tag: '" . $data[2] . "'" .
+ ",user: '" . $data[3] . "'}";
+
+ $lines[] = $line;
+ }
+ $segments = "[" . join($lines,',') . "]";
+ }
+
+ // Render json
+ echo $segments;
+ }
+}
\ No newline at end of file