當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Division類代碼示例

本文整理匯總了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));
 }
開發者ID:theki,項目名稱:Calculator,代碼行數:8,代碼來源:DivisionTest.php

示例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);
 }
開發者ID:billyriantono,項目名稱:ihrmis,代碼行數:10,代碼來源:json.php

示例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;
 }
開發者ID:bigjoevtrj,項目名稱:codeigniter-bootstrap,代碼行數:10,代碼來源:divisionrepository.php

示例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;
 }
開發者ID:Keshaun1222,項目名稱:IRIN,代碼行數:10,代碼來源:division.class.php

示例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();
 }
開發者ID:andgatetech,項目名稱:hrm,代碼行數:13,代碼來源:DivisionForm.php

示例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;
 }
開發者ID:Keshaun1222,項目名稱:IRIN,代碼行數:19,代碼來源:rank.class.php

示例7: getInstance

 /**
  * Singleton Pattern
  *
  * Auto Create Object Instance.
  *
  */
 public static function getInstance()
 {
     if (null === self::$_objInstance) {
         self::$_objInstance = new Division();
     }
     return self::$_objInstance;
 }
開發者ID:edupol,項目名稱:examsystem,代碼行數:13,代碼來源:Division.php

示例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);
     }
 }
開發者ID:Oogieboogie23,項目名稱:Division-Tracker,代碼行數:26,代碼來源:PlatoonController.php

示例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);
 }
開發者ID:nvidela,項目名稱:kimkelen,代碼行數:25,代碼來源:LvmSchoolBehaviour.class.php

示例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;
 }
開發者ID:Oogieboogie23,項目名稱:Division-Tracker,代碼行數:13,代碼來源:PS2DivisionStructure.php

示例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;
 }
開發者ID:higginsd,項目名稱:Division-Tracker,代碼行數:13,代碼來源:WgDivisionStructure.php

示例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 
}
開發者ID:jaythakur,項目名稱:policy,代碼行數:43,代碼來源:plugin.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'));
 }
開發者ID:higginsd,項目名稱:Division-Tracker,代碼行數:11,代碼來源:ApplicationController.php

示例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;
 }
開發者ID:eneelkant,項目名稱:oprecx-project,代碼行數:16,代碼來源:AdminController.php

示例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'));
 }
開發者ID:Oogieboogie23,項目名稱:Division-Tracker,代碼行數:14,代碼來源:RecruitingController.php


注:本文中的Division類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。