/**
  * @return CL_Loader
  */
 public static function get_instance()
 {
     if (self::$instance === NULL) {
         self::$instance = new CL_Loader();
     }
     return self::$instance;
 }
 public function __construct()
 {
     $this->load = CL_Loader::get_instance();
     $this->config = CL_Config::get_instance();
     $this->out = CL_Output::get_instance();
     $this->session = CL_Session::get_instance();
 }
function attribute_edit_template(AttributeModel $attr)
{
    $o = CL_Output::get_instance();
    $l = CL_Loader::get_instance();
    $o->assign('attr', $attr);
    $folder = 'attribut_edit/';
    $path = APPPATH . 'views/' . $folder;
    if (file_exists($path . $attr->get_type_ID() . '.php')) {
        return $l->view($folder . $attr->get_type_ID(), FALSE);
    }
    return $l->view($folder . 'default', FALSE);
}
Exemple #4
0
function tpl_edit($sub)
{
    $load = CL_Loader::get_instance();
    $editViewsPath = 'tpl/edit/';
    $subViewPath = $editViewsPath . $sub;
    if (view_exists($subViewPath)) {
        return view_get_html($subViewPath);
    } else {
        $load->model('POITypeModel');
        $type = POITypeModel::catFromSub($sub);
        $catViewPath = $editViewsPath . $type->id;
        if (file_exists($catViewPath)) {
            return view_get_html($catViewPath);
        }
    }
    return view_get_html($editViewsPath . 'default');
}
Exemple #5
0
function view_get_html($view)
{
    return CL_Loader::get_instance()->view($view, FALSE);
}
function include_view($view)
{
    echo CL_Loader::get_instance()->view($view, FALSE);
}
 public static function getScenarioInfo($id, $caseId)
 {
     CL_Loader::get_instance()->library('DecimillClient');
     $res = DecimillClient::call("-t", $id, "-c", $caseId, "-a", "getTempScenarioInfo");
     return json_decode($res, TRUE);
 }
Exemple #8
0
 public static function fromPostData($data)
 {
     CL_Loader::get_instance()->library('PostDataFormatException');
     $poi = new POI();
     $poi->id = (int) $data['id'];
     $poi->name = (string) $data['name'];
     $poi->label = (string) $data['label'];
     $poi->url = (string) $data['url'];
     $poi->lat = (double) $data['lat'];
     $poi->lng = (double) $data['lng'];
     // Description
     if (key_exists("description", $data)) {
         $poi->description = (string) $data['description'];
     }
     // Approach
     if (isset($data['approach'])) {
         if (!isset($data['approach']['text']) || !isset($data['approach']['drying']['value']) || !isset($data['approach']['drying']['details'])) {
             throw new PostDataFormatException("Approach");
         }
         $poi->approach['text'] = (string) $data['approach']['text'];
         $poi->approach['drying']['value'] = (string) $data['approach']['drying']['value'];
         $poi->approach['drying']['details'] = (string) $data['approach']['drying']['details'];
     }
     // Contact
     if (isset($data['contact']['type']) && isset($data['contact']['value'])) {
         // Make sure all attributes have the same length
         if (count($data['contact']['type']) === count($data['contact']['value'])) {
             for ($i = 0; $i < count($data['contact']['type']); $i++) {
                 $poi->contact[] = ['type' => (string) $data['contact']['type'][$i], 'value' => (string) $data['contact']['value'][$i]];
             }
         }
     }
     // Anchoring
     if (key_exists("anchoring", $data)) {
         // Depth
         $poi->anchoring['depth']['from'] = (double) $data['anchoring']['depth']['from'];
         $poi->anchoring['depth']['to'] = (double) $data['anchoring']['depth']['to'];
         // Holding
         $poi->anchoring['holding']['values'] = [];
         foreach ((array) @$data['anchoring']['holding']['values'] as $value) {
             $poi->anchoring['holding']['values'][] = $value;
         }
         $poi->anchoring['holding']['details'] = (string) $data['anchoring']['holding']['details'];
         // Price
         $poi->anchoring['cost'] = Cost::fromPostData($data['anchoring']['cost']);
         // Soujourn
         $poi->anchoring['tax'] = Tax::fromPostData($data['anchoring']['tax']);
     }
     // Charts
     if (key_exists("charts", $data)) {
         foreach ($data['charts'] as $chart) {
             if ($chart !== "") {
                 $poi->charts[] = (string) $chart;
             }
         }
     }
     // Sources
     if (key_exists("sources", $data)) {
         foreach ($data['sources'] as $source) {
             if ($source !== "") {
                 $poi->sources[] = (string) $source;
             }
         }
     }
     // Exposure
     if (key_exists("exposure", $data)) {
         // Wind
         $poi->exposure['wind']['value'] = (string) $data['exposure']['wind']['value'];
         foreach ((array) @$data['exposure']['wind']['dir'] as $wind) {
             if ($wind !== "") {
                 $poi->exposure['wind']['dir'][] = (string) $wind;
             }
         }
         // Swell
         $poi->exposure['swell']['value'] = (string) $data['exposure']['swell']['value'];
         foreach ((array) @$data['exposure']['swell']['dir'] as $swell) {
             if ($swell !== "") {
                 $poi->exposure['swell']['dir'][] = (string) $swell;
             }
         }
     }
     // Attractions
     if (key_exists("attractions", $data)) {
         $poi->attractions = (string) $data['attractions'];
     }
     // Nightlife
     if (key_exists("nightlife", $data)) {
         $poi->nightlife = (string) $data['nightlife'];
     }
     return $poi;
 }