Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct('delete_venue', 'Delete Venue', 'Admin/delete_venue.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->venue_id) || !is_numeric($this->venue_id)) {
         $this->pageError = true;
         return;
     }
     $venue = new pdVenue();
     $result = $venue->dbLoad($this->db, $this->venue_id);
     if (!$result) {
         $this->pageError = true;
         return;
     }
     $pub_list = pdPubList::create($this->db, array('venue_id' => $this->venue_id));
     if (isset($pub_list) && count($pub_list) > 0) {
         echo 'Cannot delete venue <b>', $venue->nameGet(), '</b>.<p/>', 'The venue is used by the following ', 'publications:', "\n", displayPubList($this->db, $pub_list, true, -1, null, null, '../');
         return;
     }
     $form =& $this->confirmForm('deleter');
     $form->addElement('hidden', 'venue_id', $venue->venue_id);
     if ($form->validate()) {
         $venue->dbDelete($this->db);
         echo 'Venue <b>', $venue->title, '</b> successfully removed from database.';
     } else {
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         if ($venue->title != '') {
             $disp_name = $venue->title;
         } else {
             $disp_name = $venue->nameGet();
         }
         echo '<h3>Confirm</h3><p/>', 'Delete Venue <b>', $disp_name, '</b> from the database?';
         $this->form =& $form;
         $this->renderer =& $renderer;
     }
 }
Exemplo n.º 2
0
            if (!empty($venue->cat_id)) {
                $op[] = $venue->cat_id;
            } else {
                $op[] = '*';
            }
            $op[] = $venue->data;
            echo '<pre>', implode("\t", $op), '</pre>', "\n";
        }
        $venue->dbSave($db);
    }
} else {
    foreach ($venues as $pub_id => $title) {
        $venue = new pdVenue();
        $venue->dbLoad($db, $pub_id);
        if (pdDB::venueTableUpgraded() == 0 && !empty($venue->data)) {
            $op = array($pub_id, $venue->nameGet());
            if (!empty($venue->cat_id)) {
                $op[] = $venue->cat_id;
            } else {
                $op[] = '*';
            }
            if (is_array($venue->options)) {
                foreach ($venue->options as $vopt) {
                    if (!empty($vopt)) {
                        $op[] = $vopt;
                    }
                }
            }
            echo '<pre>', implode("\t", $op), '</pre>', "\n";
        }
    }