Esempio n. 1
0
 /**
  * Sets multiple queue rows as done
  * @param type $rows
  */
 public function setQueueRowsDone($rows)
 {
     R::begin();
     foreach ($rows as $row) {
         $res = $this->setQueueRowDone($row);
         if (!$res) {
             return R::rollback();
         }
     }
     return R::commit();
 }
Esempio n. 2
0
        R::begin();
        foreach ($data->positions as $posItem) {
            $item = R::load('item', $posItem->item);
            $before = $item->export();
            $oldLane = $item->lane->id;
            $item->lane = R::load('lane', $posItem->lane);
            if ($oldLane != $item->lane->id) {
                $movedItem = $item;
                $beforeItem = $before;
                $afterItem = $item->export();
            }
            $item->position = $posItem->position;
            runAutoActions($item);
            R::store($item);
        }
        R::commit();
        // If an item changed lanes, log the action.
        if (null != $movedItem) {
            logAction($user->username . ' moved item ' . $movedItem->title . ' to lane ' . $movedItem->lane->name, $beforeItem, $afterItem, $movedItem->id);
        }
        $jsonResponse->addBeans(getBoards());
    }
    $app->response->setBody($jsonResponse->asJson());
});
// Add a comment to an item.
$app->post('/items/:itemId/comment', function ($itemId) use($app, $jsonResponse) {
    $data = json_decode($app->environment['slim.input']);
    if (validateToken()) {
        $user = getUser();
        $item = R::load('item', $itemId);
        if ($item->id) {
Esempio n. 3
0
 /**
  * commit a bean with transactions
  * @param object $bean
  * @return $res false or last insert id 
  */
 public static function commitBean($bean)
 {
     R::begin();
     try {
         $res = R::store($bean);
         R::commit();
     } catch (Exception $e) {
         R::rollback();
         $res = false;
     }
     return $res;
 }