// *************************************************************************************
switch ($_GET['task']) {
    // *************************************************************************************
    // Data for for storeTaxID
    // *************************************************************************************
    case "list":
        if ($_SESSION['lang']['code'] == "en_US") {
            // If the selected language is English, do not translate
            $mitos_db->setSQL("SELECT \n  \t\t\t\t\t\t\t\t\toption_id, \n  \t\t\t\t\t\t\t\t\ttitle \n  \t\t\t\t\t\t\t\tFROM \n  \t\t\t\t\t\t\t\t\tlist_options \n  \t\t\t\t\t\t\t\tWHERE \n  \t\t\t\t\t\t\t\t\tlist_id = 'lists' \n  \t\t\t\t\t\t\t\tORDER BY title, seq");
        } else {
            // Use and sort by the translated list name.
            $mitos_db->setSQL("SELECT \n\t\t\t\t\t\t\t\t\tlo.option_id, \n\t\t\t\t\t\t\t\t\tIF(LENGTH(ld.definition),ld.definition,lo.title) AS title \n\t\t\t\t\t\t\t\tFROM list_options AS lo \n\t\t\t\t\t\t\t\t\tLEFT JOIN lang_constants AS lc ON lc.constant_name = lo.title \n\t\t\t\t\t\t\t\t\tLEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND ld.lang_id = '{$lang_id}' \n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\tlo.list_id = 'lists' \n\t\t\t\t\t\t\t\tORDER BY \n\t\t\t\t\t\t\t\t\tIF(LENGTH(ld.definition),ld.definition,lo.title), lo.seq");
        }
        $total = $mitos_db->rowCount();
        foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $urow) {
            $buff .= '{"option_id":"' . dataDecode($urow['option_id']) . '","title":"' . dataDecode($urow['title']) . '"},' . chr(13);
        }
        $buff = substr($buff, 0, -2);
        // Delete the last comma.
        echo '{';
        echo '"totals": "' . $total . '", ' . chr(13);
        echo '"row": [' . chr(13);
        echo $buff;
        echo ']}' . chr(13);
        break;
        // *************************************************************************************
        // Create a new list
        // This data creation is special, we don't nee a data_create.ejs.php to do this.
        // *************************************************************************************
    // *************************************************************************************
    // Create a new list
Exemple #2
0
 public static function getObject($pathObject, $type = null)
 {
     $settings = Arrays::exists($type, static::$_settings) ? static::$_settings[$type] : static::defaultConfig($type);
     $hook = Arrays::exists('getObject', $settings) ? $settings['getObject'] : null;
     static::_hook($hook, func_get_args(), 'before');
     if (!is_string($pathObject)) {
         $id = isset($pathObject->id) ? $pathObject->id : null;
         if (null !== $id) {
             return null;
         } else {
             return $pathObject;
         }
     }
     $object = dataDecode($pathObject);
     if (null === $type) {
         $type = Inflector::lower(Utils::cut(STORAGE_PATH . DS . 'data' . DS, DS, $pathObject));
         $type = substr($type, 0, -1);
     }
     $object->setThinType($type);
     static::_hook($hook, func_get_args(), 'after');
     return $object;
 }