Example #1
0
 /**
  * @method POST
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageTypeId = -1;
         parse_str($this->request->data, $request);
         // parse request
         if (isset($request['pageTypeId'])) {
             $pageTypeId = $request['pageTypeId'];
         }
         if (isset($request['friendlyId'])) {
             $friendlyId = $request['friendlyId'];
             $pageType = PageType::GetByFriendlyId($friendlyId, $authUser->SiteId);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         if (isset($request['pageTypeUniqId'])) {
             $pageType = PageType::GetByPageTypeUniqId($request['pageTypeUniqId']);
             // look up id
             $pageTypeId = $pageType['PageTypeId'];
         }
         // check that pageTypeId was set
         if ($pageTypeId != -1) {
             $list = Category::GetCategories($pageTypeId);
             // return a json response
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = json_encode($list);
             return $response;
         } else {
             // return an empty response (e.g. root has not categories)
             $response = new Tonic\Response(Tonic\Response::OK);
             $response->contentType = 'application/json';
             $response->body = '[]';
             return $response;
         }
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
Example #2
0
                <div class="three columns">
                    <label class="right inline">Describe what you want to learn</label>
                </div>
                <div class="nine columns">
                    <?php 
echo $form->textArea($model, 'Description', array('size' => 60, 'maxlength' => 2000, 'rows' => '10', 'class' => 'ten'));
?>
                </div>
            </div>
            <div class="row">
                <div class="three columns">
                    <label class="right inline">Category</label>
                </div>
                <div class="nine columns">
                    <?php 
echo $form->dropDownList($model, 'Category_ID', Category::GetCategories(), array('class' => 'five'));
?>
                </div>
            </div>
            <div class="row">
                <div class="three columns">
                    <label class="right inline">Is tuition okay?</label>
                </div>
                <div class="nine columns">
                    <?php 
echo $form->dropDownList($model, 'HasTuition', array(0 => "ehhh, I'd prefer it be free", 1 => 'Yes, knowledge is priceless'), array('class' => 'five'));
?>
                </div>
            </div>
            <div class="row">
                <div class="three columns">
Example #3
0
echo $form->dropDownList($model, 'experienceType', $experienceType, array('class' => 'twelve filterInput'));
?>

                <label>Individuals or Businesses</label>

                <?php 
$posterType = UserPosterType::$Lookup;
$posterType[0] = 'Both';
ksort($posterType);
echo $form->dropDownList($model, 'posterType', $posterType, array('class' => 'twelve filterInput'));
?>

                <label>Category</label>

                <?php 
$categories = Category::GetCategories();
$categories[0] = 'Any';
ksort($categories);
echo $form->dropDownList($model, 'category', $categories, array('class' => 'twelve filterInput'));
?>

                <label>Price</label>

                <div class="row">
                    <div class="six columns">
                        <?php 
echo $form->textField($model, 'minPrice', array('placeholder' => 'min', 'class' => 'filterInput'));
?>
                    </div>
                    <div class="six columns">
                        <?php