Api

Version

mediamosa-30

Class

mediamosa_rest_call_ftp_batch_list

Code

File: /sites/all/modules/mediamosa/modules/ftp_batch/mediamosa_ftp_batch.rest.class.inc
<?php?php
// $Id$

/**
 * MediaMosa is Open Source Software to build a Full Featured, Webservice
 * Oriented Media Management and Distribution platform (http://mediamosa.org)
 *
 * Copyright (C) 2011 SURFnet BV (http://www.surfnet.nl) and Kennisnet
 * (http://www.kennisnet.nl)
 *
 * MediaMosa is based on the open source Drupal platform and
 * was originally developed by Madcap BV (http://www.madcap.nl)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, you can find it at:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */

 /**
  * @file
  * The ftp batch module.
  *
  * @TODO: move the code to core, lets not leave them into rest calls.
  */

/**
 * URI: /ftp_batch
 * Method: GET
 *
 * 1.x: vpx_ftp_batch_list
 *
 */
class mediamosa_rest_call_ftp_batch_list extends mediamosa_rest_call {
  
// ------------------------------------------------------------------ Consts.
  // Rest vars;

  // ------------------------------------------------------------------ Get Var Setup.
  
public function get_var_setup() {
    
$a_var_setup = array();

    
$a_var_setup $this->get_var_setup_range($a_var_setup);

    
// Enrich with required REST vars.
    
return self::get_var_setup_default($a_var_setup);
  }

  
// ------------------------------------------------------------------ Do Call.
  
public function do_call() {
    
$o_mediamosa mediamosa::get();

    
$a_app_ids $this->get_param_value_app();
    
$app_id reset($a_app_ids);

    
$limit $this->get_param_value_limit();
    
$offset $this->get_param_value_offset();

    
// Get the list.
    
$result mediamosa_ftp_batch::search($app_id$offset$limit);

    foreach (
$result as $row) {
      
// UTC -> App timezone.
      
$row[mediamosa_ftp_batch_db::STARTED] = mediamosa::utcdate2appdate($row[mediamosa_ftp_batch_db::STARTED]);
      
$row[mediamosa_ftp_batch_db::FINISHED] = mediamosa::utcdate2appdate($row[mediamosa_ftp_batch_db::FINISHED]);

      
$o_mediamosa->add_item($row);
    }

    
$o_rest_reponse->item_count_total $result->found_rows;
  }
}