Example #1
0
 public static function readAll()
 {
     if (self::$categories !== false) {
         return self::$categories;
     }
     $fd = fopen(self::CategoryFileName, 'r');
     if ($fd == null) {
         throw new Exception('File: ' . self::CategoryFileName . ' cannot be opened for reading.');
     }
     self::$categories = array();
     while (!feof($fd)) {
         $line = fgets($fd);
         if (strlen(trim($line)) == 0) {
             continue;
         }
         $parts = explode('=', $line);
         $idNameParts = explode(',', $parts[0]);
         $category = new Category($idNameParts[0], $idNameParts[1]);
         $parts = explode(';', trim($parts[1]));
         foreach ($parts as $part) {
             $category->addTransactionDescription(substr($part, 1, strlen($part) - 2));
         }
         self::$categories[$category->id] = $category;
     }
     return self::$categories;
 }
Example #2
0
 public function testCategories()
 {
     $c = new Category('php');
     $cats = $c->categories();
     $this->assertEquals(count($cats), 2);
     $this->assertEquals($cats[0]->name(), 'gd');
     $this->assertEquals($cats[1]->name(), 'unlink');
 }
 /**
  * Display a listing of Appointments under the Currently Logged User.
  *
  * @return Response
  *
  */
 public function index()
 {
     $categories = Category::categories();
     return Response::json($categories);
 }
Example #4
0
 public function showSchedule()
 {
     $data['categories'] = Category::categories();
     $data['user'] = Auth::user();
     $this->layout->content = View::make('advisor.schedule', $data);
 }