More functionality
authorJoey Schulze <joey@infodrom.org>
Thu, 26 Apr 2018 17:36:50 +0000 (19:36 +0200)
committerJoey Schulze <joey@infodrom.org>
Thu, 26 Apr 2018 17:36:50 +0000 (19:36 +0200)
class/stempel.class.php

index 23a8cff..b4119c0 100644 (file)
@@ -7,10 +7,21 @@ class Stempel extends DatabaseTable {
     parent::__construct('stempel', $id);
   }
 
-  public function ajaxEditTask(Array $data)
+  public function ajaxTask(Array $data)
   {
-    if (!strlen($data['content'])) return false;
-    return $this->modify('task', $data['content']);
+      return $this->modify('task', utf8_decode($data['content']));
+  }
+
+  public function ajaxSetStatus(Array $data)
+  {
+    if (count($data['ids'])) {
+      $sql = sprintf('UPDATE %s SET status = %d WHERE id IN (%s)',
+                    $this->table,
+                    $data['status'], implode(',',$data['ids']));
+      return $this->execute($sql);
+    }
+
+    return true;
   }
 
 }