public static function router($ctx, $id)
 {
     $vars = array();
     try {
         $vals = ADB::get($id);
         $proj_name = $vals['proj_name'];
         unset($vals['proj_name']);
     } catch (Exception $e) {
         return $e->getMessage();
     }
     $data = ADB::getFields();
     unset($data['proj_name']);
     $out = self::renderFields($data, $vals);
     $vars['id'] = $id;
     $vars['pname'] = $proj_name;
     $vars['left'] = $out['l'];
     $vars['right'] = $out['r'];
     $vars['bottom'] = $out['b'];
     $vars['contacts'] = self::renderContacts($id);
     $vars['calllog'] = self::renderCallLog($id);
     $vars['worklog'] = self::renderWorkLog($id);
     $body = Utils::at($vars, 'view');
     $ctx->appendContent(Utils::at(null, 'create_css'), 'css');
     $ctx->appendContent($body);
     return $ctx->wrapPage();
 }
 public static function router($ctx, $id)
 {
     $vars = array();
     if ($id == 'index') {
         $vals = array();
         $id = '';
         $vars['title'] = 'New Project';
         $vars['button'] = 'Create';
     } else {
         try {
             $vals = ADB::get($id);
         } catch (Exception $e) {
             return $e->getMessage();
         }
         $vars['title'] = 'Edit Project';
         $vars['button'] = 'Save';
     }
     $out = self::renderFields(ADB::getFields(), $vals);
     $vars['id'] = $id;
     $vars['left'] = $out['l'];
     $vars['right'] = $out['r'];
     $vars['bottom'] = "Bottom";
     $body = Utils::at($vars, 'create');
     $ctx->appendContent(Utils::at(null, 'create_css'), 'css');
     $ctx->appendContent($body);
     return $ctx->wrapPage();
 }
 public static function router($ctx, $id)
 {
     //$r = ADB::get($id);
     //return print_r($r,1);
     try {
         $r = ADB::get($id);
         return print_r($r, 1);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }