本文整理汇总了PHP中Division类的典型用法代码示例。如果您正苦于以下问题:PHP Division类的具体用法?PHP Division怎么用?PHP Division使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Division类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCalculate
public function testCalculate()
{
$div = new Division();
$this->assertEquals(2, $div->calculate(2, 1));
$this->assertEquals(2, $div->calculate(4, 2));
$this->assertEquals(0.5, $div->calculate(2, 4));
$this->assertEquals(3, $div->calculate(2.1, 0.7));
}
示例2: divisions
function divisions($office_id = '')
{
$d = new Division();
$divisions = $d->where('office_id', $office_id)->order_by('order')->get();
$json = array();
foreach ($divisions as $division) {
$json[$division->id] = $division->name;
}
echo json_encode($json);
}
示例3: createByName
public function createByName($name)
{
print_r('[' . $name . ']');
$document = new Division();
$document->setName($name);
$document->setSlug();
$document->save();
$document = $this->findOneBySlug($document->getSlug());
return $document;
}
示例4: isAbove
public function isAbove(Division $division)
{
if ($division->getParent()->getParent() && $division->getParent()->getParent()->getDivision() == $this->getDivision()) {
return true;
}
if ($division->getParent() && $division->getParent()->getDivision() == $this->getDivision()) {
return true;
}
return false;
}
示例5: save
public function save()
{
$divisionId = $this->getValue('divisionId');
if (!empty($divisionId)) {
$division = $this->getDivisionService()->getDivisionById($divisionId);
} else {
$division = new Division();
}
$division->setDivisionName($this->getValue('division_name'));
$division->setDivisionCode($this->getValue('division_code'));
$division->setCouCode($this->getValue('country'));
$division->save();
}
示例6: getDivisionRanks
/**
* @param Division $division
* @return Rank[]
*/
public static function getDivisionRanks(Division $division)
{
global $mysqli;
$ranks = array();
$paygrades = array('E', 'O', 'C', 'HC', 'RT', 'S');
foreach ($paygrades as $paygrade) {
$query = $mysqli->query("SELECT * FROM ranks WHERE division = {$division->getDivision()} AND rank LIKE '{$paygrade}%' ORDER BY rank");
if ($query->num_rows > 0) {
while ($result = $query->fetch_array()) {
$ranks[] = new self($result['id']);
}
}
}
return $ranks;
}
示例7: getInstance
/**
* Singleton Pattern
*
* Auto Create Object Instance.
*
*/
public static function getInstance()
{
if (null === self::$_objInstance) {
self::$_objInstance = new Division();
}
return self::$_objInstance;
}
示例8: _manage_platoon
public static function _manage_platoon($div, $plt)
{
$division = Division::findByName(strtolower($div));
$platoonId = Platoon::getIdFromNumber($plt, $division->id);
if (!is_null($platoonId)) {
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
if ($member->platoon_id == $platoonId || $user->role > 2 || User::isDev()) {
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$platoon = Platoon::findById($platoonId);
$unassignedMembers = Platoon::unassignedMembers($platoonId, true);
$squads = Squad::findByPlatoonId($platoonId);
$memberCount = count((array) Platoon::members($platoonId));
$js = 'manage';
Flight::render('manage/platoon', compact('division', 'platoon', 'squads', 'unassignedMembers', 'memberCount'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
} else {
// insufficient access
Flight::redirect('404/', 404);
}
} else {
// nonexistent platoon
Flight::redirect('404/', 404);
}
}
示例9: getAvailableStudentsForDivision
/**
* Get every student that isnt inscripted in other division.
* The inscription depends on the aproval method implemented by each school
*
* @param Division $division
*
* @return array Student[]
*/
public function getAvailableStudentsForDivision(Division $division)
{
$students_in = array();
foreach ($division->getCourses() as $course) {
foreach ($course->getNonOptionCourseSubjects() as $course_subject) {
$criteria_course = $this->getAvailableStudentsForCourseSubjectCriteria($course_subject);
$criteria_course->clearSelectColumns();
$criteria_course->addSelectColumn(StudentPeer::ID);
$stmt = StudentPeer::doSelectStmt($criteria_course);
$students_in = array_merge($stmt->fetchAll(PDO::FETCH_COLUMN), $students_in);
}
}
$c = new Criteria();
//$c->addAnd(StudentPeer::ID,$not_in,Criteria::NOT_IN);
$c->add(StudentPeer::ID, $students_in, Criteria::IN);
return StudentPeer::doSelect($c);
}
示例10: getGeneralSergeants
/**
* @param $division_structure
* @return string
*/
private function getGeneralSergeants($division_structure)
{
$general_sergeants = Division::findGeneralSergeants($this->game_id);
foreach ($general_sergeants as $general_sergeant) {
$aod_url = Member::createAODlink(['member_id' => $general_sergeant->member_id, 'rank' => Rank::convert($general_sergeant->rank_id)->abbr, 'forum_name' => $general_sergeant->forum_name]);
$division_structure .= "{$aod_url}\r\n";
}
return $division_structure;
}
示例11: getDivisionLeaders
/**
* @param $division_structure
* @return string
*/
private function getDivisionLeaders($division_structure)
{
$division_leaders = Division::findDivisionLeaders($this->game_id);
foreach ($division_leaders as $division_leader) {
$aod_url = Member::createAODlink(['member_id' => $division_leader->member_id, 'rank' => Rank::convert($division_leader->rank_id)->abbr, 'forum_name' => $division_leader->forum_name]);
$division_structure .= property_exists($division_leader, 'position_desc') ? "{$aod_url} - {$division_leader->position_desc}\r\n" : "{$aod_url}\r\n";
}
return $division_structure;
}
示例12: manage_division
function manage_division()
{
global $wpdb;
require_once 'controllers/manage-division.php';
$table = new Division();
$table->prepare_items();
$message = '';
if ('delete' === $table->current_action()) {
$message = '<div class="updated below-h2" id="message"><p>' . sprintf(__('Items deleted: %d', 'policy_library_plugin'), count($_REQUEST['id'])) . '</p></div>';
}
?>
<div class="wrap">
<div class="icon32 icon32-posts-post" id="icon-edit"><br></div>
<h2><?php
_e('Divisions', 'policy_library_plugin');
?>
<a class="add-new-h2"
href="<?php
echo get_admin_url(get_current_blog_id(), 'admin.php?page=divisions_form');
?>
"><?php
_e('Add new', 'policy_library_plugin');
?>
</a>
</h2>
<?php
echo $message;
?>
<form id="divisions-table" method="GET">
<input type="hidden" name="page" value="<?php
echo $_REQUEST['page'];
?>
"/>
<?php
$table->display();
?>
</form>
</div>
<?php
}
示例13: _help
public static function _help()
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$division = Division::findById(intval($member->game_id));
$js = 'help';
Flight::render('application/help', compact('user', 'member', 'division'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
}
示例14: getDivList
/**
*
* @return Division[]
*/
public function getDivList()
{
if ($this->_divList === FALSE) {
if (($rec = $this->getRec()) != NULL) {
$this->_divList = Division::model()->findAllByRecId($rec->id);
} else {
// FIXME null ??
$this->_divList = array();
}
}
return $this->_divList;
}
示例15: _addNewMember
public static function _addNewMember()
{
$user = User::find(intval($_SESSION['userid']));
$member = Member::find(intval($_SESSION['memberid']));
$tools = Tool::find_all($user->role);
$divisions = Division::find_all();
$division = Division::findById(intval($member->game_id));
$platoons = Platoon::find_all($member->game_id);
$platoon_id = $user->role >= 2 && !User::isDev() ? $member->platoon_id : false;
$squads = Squad::findAll($member->game_id, $platoon_id);
$js = 'recruit';
Flight::render('recruiting/new_member', compact('user', 'member', 'division', 'platoons', 'squads'), 'content');
Flight::render('layouts/application', compact('js', 'user', 'member', 'tools', 'divisions'));
}