Happy New Year!
[platal.git] / classes / plfilter.php
index 30c95f3..6b4bdda 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -62,6 +62,15 @@ abstract class PlFilterOrder implements PlExportable
         $this->_tokens = null;
     }
 
+    protected function buildExport($type)
+    {
+        $export = array('type' => $type);
+        if ($this->desc) {
+            $export['order'] = 'desc';
+        }
+        return $export;
+    }
+
     public function export()
     {
         throw new Exception("This instance is not exportable");
@@ -219,8 +228,9 @@ abstract class PFC_NChildren implements PlFilterCondition
     public function export()
     {
         $export = array();
-        foreach ($this->children as $child)
+        foreach ($this->children as $child) {
             $export[] = $child->export();
+        }
         return array('children' => $export);
     }
 }
@@ -374,6 +384,14 @@ abstract class PlFilter implements PlExportable
      */
     public abstract function get($limit = null);
 
+    /** Get ids, selecting only those within a limit
+     * @param $limit The portion of the matching objects to select
+     */
+    public function getIds($limit = null)
+    {
+        return $this->get($limit);
+    }
+
     /** PRIVATE FUNCTIONS
      */