Exemplo n.º 1
0
  <?php foreach($modx->documentListing as $alias => $id): ?>
  <li><?php echo $id ?> - <a href="[~[*id*]~]?edit_id=<?php echo $id ?>"><?php echo $alias ?></a></li>
  <?php endforeach; ?>
</ul>

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

//define('IN_MANAGER_MODE', 'true');
//App::debug(get_defined_constants(true));

$path = realpath('/../' . dirname(__FILE__));
require_once $path.'/Resource/Save.php';
$crud = new Resource_Save;
$crud->set_content_fields($_POST);
if( !empty($_POST) ) {
  $crud->execute();
}

unset($crud->modx);
//App::debug($crud);

if( !isset($_GET['edit_id']) ) {
  echo 'no id is set';
  return;
}

$edit_id = $_GET['edit_id'];
$doc = $modx->getTemplateVars('*', '*', $edit_id);
Exemplo n.º 2
0
<?php
echo 'hello<br/><br/>';
error_reporting(E_ALL);
ini_set('display_errors', '1');

//define('IN_MANAGER_MODE', 'true');
//App::debug(get_defined_constants(true));

$path = realpath('/../' . dirname(__FILE__));
require_once $path.'/Resource/Save.php';
$crud = new Resource_Save;
$crud->set_content_fields($_POST['test']);
if( !empty($_POST) ) {
  $crud->execute();
}

//unset($crud->modx);
//App::debug($crud);

$fields = $crud->get_content_field_names();

$tvs_to_test = array(
  'tv_one'   => 'tv1',
  'tv_two'   => 'tv2',
  'tv_three' => 'tv3',
  'tv NA'    => 'tv99',
  );

foreach ($tvs_to_test as $label => $id) {
  $tv_val[$id] = isset($_POST[$id]) ? $_POST[$id] : '';
}