示例#1
0
 public function indexAction()
 {
     $tmp_info = $this->_model->get($this->authed_user, 'uid');
     unset($tmp_info->perms);
     $this->_view->data['info'] = $tmp_info;
     API::callHooks($this->module, $this->action, 'controller', $this->_view->data);
     $this->addModuleTemplate($this->module, "index");
 }
示例#2
0
 /**
  * default delete action pretty straight forward
  *
  * @return none
  */
 public function deleteAction()
 {
     if (!isset($this->params['cancel'])) {
         if ($this->_model->name == "admin") {
             API::Message("You cannot delete 'admin'");
         } else {
             // XXX: Maybe do some hook call validation here?
             // auto call the hooks for this module/action
             API::callHooks(self::$module, $this->action, 'controller', $this->req_id);
             // delete an entry
             $host = $this->_model->delete();
         }
     }
     API::redirect(API::printUrl($this->_redirect));
 }
示例#3
0
	  	<div><label>Host: </label><input type="text" name="name" value="<?php 
echo $view->getInfoValue("name");
?>
" /><br /></div>
  		<div><label>Alias: </label><input type="text" name="alias" value="<?php 
echo $view->getInfoValue("alias");
?>
" /><br /></div>
  		<div><label>Primary<br />MAC Address: </label><input style="margin-top: 12px;" type="text" name="primary_mac" value="<?php 
echo $view->getInfoValue("primary_mac");
?>
" /><br /></div>
  	</div>
  	<br />
  	
  	<!--  BEGIN HOSTS HOOKS -->
  	<div class="hostHookInfo">
  		<?php 
API::callHooks($view->module, $view->action, 'display', $view->getInfoValue('id'));
?>
  	</div>
	<!--  END HOSTS HOOKS -->
	
	<br />
	<div class="formButtons">
		<input class="formButton" type="submit" value="Save" /> <input class="formButton" id="btn_Cancel"  type="submit" name="cancel" value="Cancel" />
	</div>

  </form>

 /**
  * default action processing new requests passed in from the display action.  Does
  * not use a template. Uses the 'set_data' function on the model object of the implementing
  * class to do data verification.
  *
  * @return none
  */
 public function newAction()
 {
     # process the new entry form.
     # check the post data and filter it.
     if (isset($_POST['cancel'])) {
         API::Redirect(API::printUrl($this->_redirect));
     }
     $input_check = $this->_model->check_input($_POST);
     if (is_array($input_check)) {
         API::Error($input_check);
         // redirect to index and displayed an error there.
         API::redirect(API::printUrl($this->_redirect));
     }
     // all hooks will stack their errors onto the API::Error stack
     // but WILL NOT redirect.
     API::callHooks(self::$module, 'validate', 'controller', $_POST);
     if (API::hasErrors()) {
         API::redirect(API::printUrl($this->_redirect));
     }
     // set the id into the post var for any hooks.
     $_POST['id'] = $this->_model->set_data($_POST, TRUE);
     // auto call the hooks for this module/action
     API::callHooks(self::$module, 'save', 'controller', $_POST);
     if (isset($this->params['redir'])) {
         API::Redirect($this->params['redir']);
     }
     API::redirect(API::printUrl($this->_redirect));
 }
示例#5
0
 <?php 
echo $view->getInfoValue('lname');
?>
</h2>
<br /><br />
<div id="prefsForm" style="width:300px">
<strong>General:</strong>
<hr />
<form action="<?php 
echo API::printUrl($view->module, 'edit');
?>
" method="post">
<input type="hidden" name="uid" value="<?php 
echo $view->getInfoValue('uid');
?>
" />
<div><label>First Name</label><span class="frmTxtInput"><input type="text" name="fname" value="<?php 
echo $view->getInfoValue('fname');
?>
" /></span></div>
<div><label>Last Name</label><span class="frmTxtInput"><input type="text" name="lname" value="<?php 
echo $view->getInfoValue('lname');
?>
" /></span></div>
<?php 
echo API::callHooks("prefs", "index", "view", $data);
?>
<div><span class="frmButtons"><input class="formButton" type="submit" name="save" value="Save" /><input class="formButton" type="submit" name="cancel" id="btn_Cancel" value="Cancel" /></span></div>
</form>
</div>
示例#6
0
?>
" />
<?php 
if ($view->data['action'] == 'edit') {
    ?>
  	Username: <div class="frm_value"><?php 
    echo $view->getInfoValue("name");
    ?>
<br /></div>
<?php 
} else {
    ?>
	<div> <label>Username: </label><input type="text" name="uname" value="<?php 
    echo $view->getInfoValue("name");
    ?>
" /><br /></div>
<?php 
}
?>
  	<div><label>Password: </label><input type="password" name="password" value="" /><br /></div>
  	<div><label>Verify Password: </label><input type="password" name="password2" value="" /><br /></div>

  	<?php 
API::callHooks($view->module, 'display', 'view', $data);
?>
  	<br />
  	<input class="formButton" type="submit" value="Save" /> <input class="formButton" type="submit" name="cancel" value="Cancel" />

  </form>