Example #1
0
 public static function afterImportCategory($elemtype, &$table, $xml, &$data)
 {
     $app = isset($xml->app) ? (string) $xml->app : '';
     $core = $app ? JCckDatabase::loadObject('SELECT id, pk FROM #__cck_core WHERE app = "' . $app . '"') : 0;
     if (is_object($core)) {
         $id = $core->id;
         $isNew = false;
     } else {
         $id = JCckPluginLocation::g_onCCK_Storage_LocationPrepareStore();
         $isNew = true;
     }
     if (@$core->pk > 0) {
         $table->id = $core->pk;
     }
     $table->description = '::cck::' . $id . '::/cck::<br />::description::::/description::';
     //todo
     $table->parent_id = $data['root_category'] > 0 ? $data['root_category'] : 1;
     $rules = new JAccessRules('{"core.create":[],"core.delete":[],"core.edit":[],"core.edit.state":[],"core.edit.own":[]}');
     $table->setRules($rules);
     $table->setLocation($table->parent_id, 'last-child');
     $table->check();
     $table->store();
     $data['root_category'] = $data['root_category'] > 0 ? $data['root_category'] : $table->id;
     $data['categories'][$app] = $table->id;
     if ($table->rebuildPath($table->id)) {
         $table->rebuild($table->id, $table->lft, $table->level, $table->path);
     }
     if ($isNew === true) {
         $core = JCckTable::getInstance('#__cck_core', 'id');
         $core->load($id);
         $core->pk = $table->id;
         $core->cck = 'category';
         //todo
         $core->storage_location = 'joomla_category';
         $core->author_id = JCck::getConfig_Param('integration_user_default_author', 42);
         //todo
         $core->parent_id = $table->parent_id;
         $core->date_time = '';
         //todo
         $core->app = $app;
         $core->storeIt();
     }
 }
Example #2
0
 protected function _initTable(&$table, &$data, &$config, $force = false)
 {
     if (!$table->{self::$key}) {
         parent::g_initTable($table, isset($config['params']) ? $config['params'] : $this->params->toArray(), $force);
     }
 }
 protected function _initTable_fromSite(&$table, &$data, &$config, $force = false)
 {
     if (!$table->{self::$key}) {
         parent::g_initTable($table, isset($config['params']) ? $config['params'] : $this->params->toArray(), $force);
     } else {
         if (!JFactory::getUser()->authorise('core.admin', 'com_users')) {
             unset($data['block']);
         }
     }
 }
Example #4
0
 public static function checkIn($pk = 0)
 {
     if (!$pk) {
         return false;
     }
     $table = self::_getTable($pk);
     return parent::g_checkIn($table);
 }
    $fields[$name]->value = $value;
} else {
    $value = '';
    if ($x2k > -1) {
        if ($array_x) {
            //GroupX
            $search = '::' . $name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '::/' . $name . '|' . $x2k . '|' . $parent_name . '::';
            $replace = '::' . $name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $file_location . '","file_title":"' . $file_title . '"}' . '::/' . $name . '|' . $x2k . '|' . $parent_name . '::';
        } else {
            //FieldX
            $search = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::';
            $replace = '::' . $true_name . '|' . $x2k . '|' . $parent_name . '::' . '{"file_location":"' . $file_location . '","file_title":"' . $file_title . '"}' . '::/' . $true_name . '|' . $x2k . '|' . $parent_name . '::';
        }
    } else {
        $search = '||' . $name . '||' . '{"file_location":"' . $old_path . $file_name . '","file_title":"' . $file_title . '"}' . '||/' . $name . '||';
        $replace = '||' . $name . '||||/' . $name . '::';
    }
    $doSave = 1;
}
if ($doSave) {
    // Update
    $storage = $process['storage'];
    $table = $process['storage_table'];
    $field = $process['storage_field'];
    if (!(isset($search) && isset($replace))) {
        $field2 = $process['storage_field2'];
        $search = JCck::callFunc_Array('plgCCK_Storage' . $storage, '_format', array($field2, $search_v));
        $replace = JCck::callFunc_Array('plgCCK_Storage' . $storage, '_format', array($field2, $replace_v));
    }
    JCckPluginLocation::g_onCCK_Storage_LocationUpdate($config['pk'], $table, $field, $search, $replace);
}