本文整理汇总了PHP中Timer::print_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::print_comment方法的具体用法?PHP Timer::print_comment怎么用?PHP Timer::print_comment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::print_comment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Timer
/**
* Modify current reservation time
* If this reservation is part of a recurring group, all reservations in the
* group will be modified that havent already passed
* @param Object $res reservation that we are modifying
* @param array $users_to_invite hashtable of users to invite to this reservation
* @param array $users_to_remove hashtable of users to remove from this reservation
* @param array $resources_to_add array of resourceids to add to this reservation
* @param array $resources_to_remove array of resourceids to remove from this reservation
* @param string $accept_code acceptance code to be used for reservation accept/decline
*/
function mod_res($res, $users_to_invite, $users_to_remove, $resources_to_add, $resources_to_remove, $accept_code)
{
$t = new Timer("mod_res()");
$t->start();
$id = $res->get_id();
// Update the main reservation data
$values = array($res->get_start_date(), $res->get_end_date(), $res->get_start(), $res->get_end(), mktime(), $res->get_summary(), $res->get_pending(), $res->get_allow_participation(), $res->get_allow_anon_participation(), $id);
$query = 'UPDATE ' . $this->get_table(TBL_RESERVATIONS) . ' SET ' . ' start_date=?,' . ' end_date=?,' . ' starttime=?,' . ' endtime=?,' . ' modified=?,' . ' summary=?,' . ' is_pending=?,' . ' allow_participation=?,' . ' allow_anon_participation=?' . ' WHERE resid=?';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);
// Update the owner of the reservation
$query = 'UPDATE ' . $this->get_table(TBL_RESERVATION_USERS) . ' SET memberid=? WHERE resid=? AND owner = 1';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, array($res->get_memberid(), $res->get_id()));
$this->check_for_error($result);
//die('updated owner');
// Insert all new invitees
if (count($users_to_invite) > 0) {
$values = array();
// Reset values
foreach ($users_to_invite as $memberid => $email) {
$values[] = array($id, $memberid, 0, 1, 0, 0, $accept_code, $id, $memberid);
}
// Equivalent to 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_USERS) . ' VALUES(?,?,?,?,?,?,?) WHERE NOT EXISTS (SELECT 1 FROM ' . $this->get_table(TBL_RESERVATION_USERS) . ' WHERE resid=? AND memberid=?)';
// This is needed in case a user is being added to a group of recurring reservations and already exsits on another one
$query = 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_USERS) . ' SELECT ?,?,?,?,?,?,? FROM ' . $this->get_table(TBL_MUTEX) . ' mutex' . ' LEFT OUTER JOIN ' . $this->get_table(TBL_RESERVATION_USERS) . ' ru ON ru.resid=? AND ru.memberid=?' . ' WHERE mutex.i = 1 AND ru.resid IS NULL AND ru.memberid IS NULL';
$q = $this->db->prepare($query);
$result = $this->db->executeMultiple($q, $values);
$this->check_for_error($result);
}
// Delete all removed/uninvited users
if (count($users_to_remove) > 0) {
$userids = array();
// Reset values
$userids = array_keys($users_to_remove);
$query = 'DELETE FROM ' . $this->get_table(TBL_RESERVATION_USERS) . ' WHERE resid=? AND memberid IN (' . $this->make_del_list($userids) . ')';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, array($id));
$this->check_for_error($result);
}
// Insert all new additional resource records
if (count($resources_to_add) > 0) {
$values = null;
for ($i = 0; $i < count($resources_to_add); $i++) {
$values[] = array($id, $resources_to_add[$i], 0, $id, $resources_to_add[$i]);
}
// Equivalent to 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' VALUES(?,?,?) WHERE NOT EXISTS (SELECT 1 FROM ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' WHERE resid=? AND resourceid=?)';
// This is needed in case a resource is being added to a group of recurring reservations and already exsits on another one
$query = 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' SELECT ?,?,? FROM ' . $this->get_table(TBL_MUTEX) . ' mutex' . ' LEFT OUTER JOIN ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' ar ON ar.resid=? AND ar.resourceid=?' . ' WHERE mutex.i = 1 AND ar.resid IS NULL AND ar.resourceid IS NULL';
$q = $this->db->prepare($query);
$result = $this->db->executeMultiple($q, $values);
$this->check_for_error($result);
}
// Delete all removed additional resources
if (count($resources_to_remove) > 0) {
$query = 'DELETE FROM ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' WHERE resid=? AND resourceid IN (' . $this->make_del_list($resources_to_remove) . ')';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, array($id));
$this->check_for_error($result);
}
$t->stop();
$t->print_comment();
unset($values, $query);
}
示例2: search
// Connect to database
$link = CmnFns::getNewLink();
// Get Link object
// Perform function based on if search button has been pressed
if (isset($_POST['search']) || isset($_GET['text'])) {
search($_POST['outputtype'], $_POST['searchtype']);
} else {
showForm($db->get_min_max(), $db->get_table_data('login', array('memberid', 'fname', 'lname'), array('lname', 'fname')), $db->get_table_data('resources', array('machid', 'name'), array('name')), $db->get_table_data('schedules', array('scheduleid', 'scheduletitle'), array('scheduletitle')));
}
$t->endMain();
// End main table
$t->printHTMLFooter();
// Print HTML footer
/****** END MAIN CODE ******/
$timer->stop();
$timer->print_comment();
/**
* Perform search and print out results
* This function will perform the search for given
* criteria and print out formatted results.
* @param string $type output type
* @global $_POST['memberid'] array array of memberid's
* @global $_POST['piid'] array array of piID's
* @global $_POST['machid'] array array of machID's
* @global $_POST['startYear'] int starting year
* @global $_POST['startMonth'] int starting month
* @global $_POST['startDay'] int starting day
* @global $_POST['endYear'] int ending year
* @global $_POST['endMonth'] int ending month
* @global $_POST['endDay'] int ending day
* @global $_POST['starttime'] double starting time