/**
  * Constructor
  *
  * Sets up the table
  *
  * @param   string $tablename  unique name for the table e.g. 'users-list'
  */
 function __construct($tablename = false)
 {
     if (!$tablename) {
         tina_mvc_error("tina_mvc_table_helper_class Error: tina_mvc_table_helper_class requires the \$tablename parameter.");
     }
     $this->set_name($tablename);
     $this->set_id($tablename);
     $this->do_not_esc_th = FALSE;
 }
Beispiel #2
0
 /**
  * Locates a Tina MVC model file and return an instance of the model class
  *
  * Looks for a file in the same order as for controllers and view files. Model files are named {$model}_model.php and
  * define a class called {$model}
  *
  * @param   string $model the name of the model file (without '_model.php')
  * @param string $custom_folder path to load the model from
  * @return  object an instance of the model class
  */
 public function load_model($model = '', $custom_folder = FALSE)
 {
     if (!$model) {
         tina_mvc_error(__FILE__ . ' :: ' . __FUNCTION__ . ' (' . __LINE__ . ') requires $model argument.');
     }
     $model_filename = $model . '_model.php';
     //custom location?
     if ($custom_folder) {
         if (file_exists($f = "{$custom_folder}/{$model_filename}")) {
             return $this->include_model($f, $model);
         }
         error("File '{$model_filename}' does not exist in location '{$custom_folder}'.");
     }
     $search_errors = array();
     if ($f = find_app_file($model_filename, $this->tina_mvc_page, $this->called_from, $search_errors)) {
         return $this->include_model($f, $model);
     }
     // we have an error if we get here...
     // error
     $e = "Can't find model file:\r\n";
     $e .= "<small><pre>" . $model_filename . "</pre></small>\r\n";
     $e .= "Looked in:\r\n";
     $e .= "<small><pre>";
     foreach ($search_errors as $d) {
         $e .= str_replace(plugin_folder(), '', $d) . "\r\n";
     }
     $e .= "</pre></small>\r\n";
     error($e, $suppress_esc = TRUE);
 }
Beispiel #3
0
/**
 * Gets a value from $_GET
 *
 * @param   string  $var The variable name to retrieve
 * @return  mixed The $_GET var
 * @see     Notes in get_post()
 */
function get_get($var = NULL)
{
    if (is_null($var)) {
        tina_mvc_error(__FILE__ . ' :: ' . __FUNCTION__ . ' required a non NULL argument');
    }
    if (array_key_exists($var, $_GET)) {
        return stripslashes($_GET["{$var}"]);
    } else {
        return FALSE;
    }
}