public function offsetGet($offset)
 {
     $helper = new ListsHelper();
     if ($offset) {
         $keys = Keywords::getKeyCodes();
         $exp = '[';
         foreach ($keys as $id => $code) {
             $exp .= '\\' . $code;
         }
         $exp .= ']';
         preg_match('/^(' . $exp . ')(.*?)$/', $offset, $matches);
         if (count($matches)) {
             $exists = array_search($matches[1], $keys);
             if ($exists !== false) {
                 if ($matches[2]) {
                     $helper->getTasksByKeyword($matches[2], $exists);
                     #FB::info($helper, 'Tasks for Keyword');
                 } else {
                     $helper->getKeynamesByKeyType($exists);
                 }
             }
         } else {
             if (Keywords::keyExists($offset, "'/'")) {
                 /**
                  *  Handling directory as a list
                  **/
                 $type = array_search('/', $keys);
                 #FB::log($type, 'TYPE');
                 Site::$section = '/' . $offset;
                 $helper->getTasksByKeyword($offset, $type);
                 #FB::info(self::$lists, 'Tasks for Keyword 2');
             } else {
                 #FB::error($offset, 'We don\'t know this');
             }
         }
     } else {
         /**
          *  @todo add javascript handling of location.hash 			
          **/
         #FB::error('@todo location.hash js');
         $helper->getLists();
     }
     if (!isset($helper->lists)) {
         $helper->getLists();
     }
     self::$lists = $helper->lists;
 }
    public function addItem($data)
    {
        if (!$data) {
            $data = self::getPostData();
        }
        #FB::info($data['nada'], 'Nothing here?');
        if (!$data['nada']) {
            #FB::info($data, 'adding');
            $task = self::writeTask($data);
            #FB::log($data, $task);
            $user = Site::$user;
            $list = 1;
            self::addTaskUserRelation($task, $user);
            ListsHelper::addListTaskRelation($list, $task);
            if ($data['keys']) {
                foreach ($data['keys'] as $key => $name) {
                    if (is_array($name)) {
                        foreach ($name as $key => $name) {
                            #FB::info($name, $key);
                            self::addRelations($name, $key, $task);
                        }
                    } else {
                        #FB::info($name, $key);
                        self::addRelations($name, $key, $task);
                    }
                    #FB::info($name, $key);
                }
            }
            return '{
				"status": "success",
				"string": "Added a task with id ' . $task . '"
			}';
        } else {
            return '{
				"status": "warn",
				"string": "Nothing sent up"
			}';
        }
    }