示例#1
0
 case 'edit':
     $id = $_GET['id'];
     if (!$gm->fetchBox(GM_CONTACT, 'detail', $id)) {
         die($gm->lastActionStatus());
     }
     $sps = $gm->getSnapshot(GM_CONTACT);
     $tpl = new Templates('tpls');
     foreach ($sps->contacts as $c) {
         $tpl->set('contact_form', array('name' => $c['name'], 'email' => $c['email'], 'id' => $id));
         $tpl->set('main', 'content', $tpl->parse('contact_form'));
     }
     print $tpl->parse('main');
     break;
 case 'del':
     $id = $_GET['id'];
     if (!$gm->deleteContact($id)) {
         die($gm->lastActionStatus());
     }
     header("Location: ?mode=list");
     break;
 case 'supply':
     // TODO notes & details
     if (!$gm->editContact($_POST['id'], $_POST['name'], $_POST['email'], "")) {
         die($gm->lastActionStatus());
     }
     header("Location: ?mode=list");
     break;
 case 'email':
     $email = $_GET['email'];
     if (!isset($email)) {
         $email = "";