コード例 #1
0
	INITIALIZATION METHODS
*********************************/
require '../../bootstrap.php';
Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/fields.php');
$pommo->init();
$logger =& $pommo->_logger;
$dbo =& $pommo->_dbo;
/**********************************
	SETUP TEMPLATE, PAGE
 *********************************/
Pommo::requireOnce($pommo->_baseDir . 'inc/classes/template.php');
$smarty = new PommoTemplate();
$smarty->prepareForForm();
// add field if requested, redirect to its edit page on success
if (!empty($_POST['field_name'])) {
    $field = PommoField::make(array('name' => $_POST['field_name'], 'type' => $_POST['field_type'], 'prompt' => 'Field Prompt', 'required' => 'off', 'active' => 'off'));
    $id = PommoField::add($field);
    if ($id) {
        $smarty->assign('added', $id);
    } else {
        $logger->addMsg(Pommo::_T('Error with addition.'));
    }
}
// check for a deletion request
if (!empty($_GET['delete'])) {
    $field = PommoField::get(array('id' => $_GET['field_id']));
    $field =& current($field);
    if (count($field) === 0) {
        $logger->addMsg(Pommo::_T('Error with deletion.'));
    } else {
        $affected = PommoField::subscribersAffected($field['id']);