예제 #1
0
 /**
  * Read a GET value and if exists it return to concatenate with the query
  * @param unknown $key
  * @param unknown $toadd The name of the field in the database
  * @param unknown $comparator !=, <, >, =
  */
 private function getQuery($key, $toadd, $comparator = '=')
 {
     $val = kw::get($key);
     if ($val != '') {
         return ' and ' . $toadd . $comparator . $val . ' ';
     }
     return '';
 }
예제 #2
0
 function rewriter($module = '', $controller = '', $action = '', $get = '', $lang = '')
 {
     // Base URL
     $r = kw::$config['url_base'];
     // Actions
     $r .= '?lang=' . kw::get('lang');
     $r .= '&m=' . ($module != '' ? $module : kw::get('m'));
     $r .= '&c=' . ($controller != '' ? $controller : kw::get('c'));
     $r .= '&a=' . ($action != '' ? $action : kw::get('a'));
     // Final GET
     if ($get != '') {
         $r .= '&' . $get;
     }
     return $r;
 }
예제 #3
0
 /**
  * @name t (translate) This function show a translated text
  *  It selfinclude the language files
  *  All files have to be located in $app/private/modules/$module/lang/$lang-$LOCALE/$category (controller or something)
  * @param string $text Specify type of file (the name)
  * @param string $category
  * @param string $params
  */
 static function t($text, $category = 'generic', $params = array())
 {
     static $texts = array();
     // Loading main language file
     //include (kw::$dir . "system/language/".$lang.".php");
     if (isset($texts[$category][$text])) {
         //if exist the text to translate
         return $texts[$category][$text];
     } elseif (!isset($texts[$category])) {
         // main category is not included
         $file = kw::$app_dir . 'private/modules/' . kw::get('m') . '/lang/' . kw::$lang . '/' . $category . '.php';
         if (is_file($file)) {
             // File exists
             $texts[$category] = (include $file);
             return isset($texts[$category][$text]) ? $texts[$category][$text] : $text;
         } else {
             // File not exists, so it will be empty
             $texts[$category] = array();
         }
     }
     return $text;
 }
예제 #4
0
 /**
  * @name loadData
  * This function load a file located in $appdir/private/modules/$module/$file.php
  * The loaded file must RETURN something (like array or string), NOT echo (if you do this, use ob_start and return buffer)
  * @param string $data
  */
 static function loadData($file)
 {
     return require kw::$app_dir . 'private/modules/' . kw::get('m') . '/data/' . $file . '.php';
 }