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


PHP Contract類代碼示例

本文整理匯總了PHP中Contract的典型用法代碼示例。如果您正苦於以下問題:PHP Contract類的具體用法?PHP Contract怎麽用?PHP Contract使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Contract類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: transform

 /**
  * Transforms an object (contract) to a string (name).
  *
  * @param  Contract|null $entity
  * @return string
  */
 public function transform($entity)
 {
     if (null === $entity) {
         return "";
     }
     return $entity->getNumber() . ' / ' . $entity->getDoor()->getLocation() . ' / ' . $entity->getDoor()->getType();
 }
開發者ID:jlm-entreprise,項目名稱:contract-bundle,代碼行數:13,代碼來源:ContractToStringTransformer.php

示例2: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
 {
     global $DB, $CFG_GLPIG;
     if (!Session::haveRight("contract", "r")) {
         return false;
     }
     $type = $item->getType();
     $ID = $item->getField('id');
     $con = new Contract();
     $query = "SELECT *\n                FROM `glpi_contracts_items`\n                WHERE `glpi_contracts_items`.`items_id` = '" . $ID . "'\n                      AND `glpi_contracts_items`.`itemtype` = '" . $type . "'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = $j = 0;
     $pdf->setColumnsSize(100);
     if ($number > 0) {
         $pdf->displayTitle('<b>' . _N('Associated contract', 'Associated contracts', 2) . '</b>');
         $pdf->setColumnsSize(19, 19, 19, 16, 11, 16);
         $pdf->displayTitle(__('Name'), _x('phone', 'Number'), __('Contract type'), __('Supplier'), __('Start date'), __('Initial contract period'));
         $i++;
         while ($j < $number) {
             $cID = $DB->result($result, $j, "contracts_id");
             $assocID = $DB->result($result, $j, "id");
             if ($con->getFromDB($cID)) {
                 $pdf->displayLine(empty($con->fields["name"]) ? "(" . $con->fields["id"] . ")" : $con->fields["name"], $con->fields["num"], Html::clean(Dropdown::getDropdownName("glpi_contracttypes", $con->fields["contracttypes_id"])), str_replace("<br>", " ", $con->getSuppliersNames()), Html::convDate($con->fields["begin_date"]), sprintf(_n('%d month', '%d months', $con->fields["duration"]), $con->fields["duration"]));
             }
             $j++;
         }
     } else {
         $pdf->displayTitle("<b>" . __('No item found') . "</b>");
     }
     $pdf->displaySpace();
 }
開發者ID:geldarr,項目名稱:hack-space,代碼行數:32,代碼來源:contract_item.class.php

示例3: actionLoadContractsSampler

 public function actionLoadContractsSampler()
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     for ($i = 0; $i < 11; $i++) {
         $owner = Yii::app()->user->userModel;
         $name = 'Mass Delete ' . $i;
         $currencies = Currency::getAll();
         $currencyValue = new CurrencyValue();
         $currencyValue->value = 500.54;
         $currencyValue->currency = $currencies[0];
         $contract = new Contract();
         $contract->owner = $owner;
         $contract->name = $name;
         $contract->amount = $currencyValue;
         $contract->closeDate = '2011-01-01';
         //eventually fix to make correct format
         $contract->stage->value = 'Negotiating';
         $saved = $contract->save();
         if (!$saved) {
             throw new NotSupportedException();
         }
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:25,代碼來源:DemoController.php

示例4: testB

 public function testB()
 {
     $testValue1 = 100;
     $testValue2 = 'red';
     $testValue3 = array('name' => 'John Smith', 'age' => 30);
     $contract = new Contract(array('test1' => array('data' => $testValue1, 'definition' => 'integer'), 'test2' => array('data' => $testValue2, 'definition' => array('length' => 3, 'in' => array('red', 'green', 'blue'))), 'test3' => array('data' => $testValue3, 'definition' => array('arraylist', 'element' => array('age' => array('integer', 'lessThan' => 29), 'name' => array('alpha', 'in' => array('John Doe', 'Jane Smith')))))));
     $contract->metOrThrow();
 }
開發者ID:jeisc,項目名稱:PHP-Contract,代碼行數:8,代碼來源:Array_Notation.php

示例5: filterByValidUser

 public function filterByValidUser($usersData)
 {
     /* Before filtering the data, establish the agreement for the method parameters. */
     $contract = new Contract();
     $contract->term('usersData')->arraylist();
     $contract->metOrThrow();
     /* Users data must be an array of elements, each element an array itself, with an id, name, registered date, and active boolean true.
        Allowed fields to be returned are the defined elements: id, name, registered, active. */
     $contract->term('usersData')->elements()->arraylist()->element('id')->id()->end()->element('name')->optional()->alpha()->end()->element('registered')->datetime()->end()->element('active')->boolean()->equals(true)->end();
     $filteredData = $contract->term('usersData')->data();
     return $filteredData;
 }
開發者ID:jeisc,項目名稱:PHP-Contract,代碼行數:12,代碼來源:Filter.php

示例6: createUser

 public function createUser($userId, $userData)
 {
     /* Define Contract Requirements for Model Data */
     $contract = new Contract();
     $contract->term('userId')->id();
     $contract->term('userData')->arraylist()->element('type')->in(array('member', 'administrator'))->end()->element('username')->alphaNumeric()->length(8, 16)->end()->element('name')->required()->end()->element('address')->required()->end()->element('city')->required()->end()->element('state')->length(2)->end()->element('zip')->length(5, 10)->end()->element('country')->required()->end()->element('email')->email()->end()->element('phone')->phone()->end()->element('fax')->optional()->phone()->end()->element('photo')->optional()->file()->end()->element('website')->optional()->url()->end()->element('registered')->datetime()->end()->element('active')->boolean()->end();
     $contract->metOrThrow();
     /* Follow w/ Basic MySQL Query */
     $rows = array();
     /* $select = "SELECT * FROM user WHERE id = {$userId}";
     		while($row = mysql_query($select)) $rows[] = $row; */
     return $rows;
 }
開發者ID:jeisc,項目名稱:PHP-Contract,代碼行數:13,代碼來源:Model.php

示例7: can

 /**
  * Check right on an contract - overloaded to check max_links_allowed
  *
  * @param $ID ID of the item (-1 if new item)
  * @param $right Right to check : r / w / recursive
  * @param $input array of input data (used for adding item)
  *
  * @return boolean
  **/
 function can($ID, $right, &$input = NULL)
 {
     if ($ID < 0) {
         // Ajout
         $contract = new Contract();
         if (!$contract->getFromDB($input['contracts_id'])) {
             return false;
         }
         if ($contract->fields['max_links_allowed'] > 0 && countElementsInTable($this->getTable(), "`contracts_id`='" . $input['contracts_id'] . "'") >= $contract->fields['max_links_allowed']) {
             return false;
         }
     }
     return parent::can($ID, $right, $input);
 }
開發者ID:ryukansent,項目名稱:Thesis-SideB,代碼行數:23,代碼來源:contract_item.class.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     UserTestHelper::createBasicUser('jim');
     AllPermissionsOptimizationUtil::rebuild();
     ContractTestHelper::createContractStagesIfDoesNotExist();
     ContractTestHelper::createContractSourcesIfDoesNotExist();
     $currencies = Currency::getAll();
     //Make Contracts for testing chart data.
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 200;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc1';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Negotiating';
     $contract->source->value = 'Outbound';
     assert($contract->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 350;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc2';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Negotiating';
     $contract->source->value = 'Trade Show';
     assert($contract->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $contract = new Contract();
     $contract->owner = $super;
     $contract->name = 'abc2';
     $contract->amount = $currencyValue;
     $contract->closeDate = '2011-01-01';
     $contract->stage->value = 'Verbal';
     $contract->source->value = 'Trade Show';
     assert($contract->save());
     // Not Coding Standard
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:49,代碼來源:ContractsChartDataProviderTest.php

示例9: testSaveAndRetrievePortlet

 public function testSaveAndRetrievePortlet()
 {
     $user = UserTestHelper::createBasicUser('Billy');
     $contracts = Contract::getByName('superOpp');
     $portlet = new Portlet();
     $portlet->column = 2;
     $portlet->position = 5;
     $portlet->layoutId = 'Test';
     $portlet->collapsed = true;
     $portlet->viewType = 'ContractsForContactRelatedList';
     $portlet->serializedViewData = serialize(array('title' => 'Testing Title'));
     $portlet->user = $user;
     $this->assertTrue($portlet->save());
     $portlet = Portlet::getById($portlet->id);
     $params = array('controllerId' => 'test', 'relationModuleId' => 'test', 'relationModel' => $contracts[0], 'redirectUrl' => 'someRedirect');
     $portlet->params = $params;
     $unserializedViewData = unserialize($portlet->serializedViewData);
     $this->assertEquals(2, $portlet->column);
     $this->assertEquals(5, $portlet->position);
     $this->assertEquals('Testing Title', $portlet->getTitle());
     $this->assertEquals(false, $portlet->isEditable());
     $this->assertEquals('Test', $portlet->layoutId);
     //$this->assertEquals(true,                  $portlet->collapsed); //reenable once working
     $this->assertEquals('ContractsForContactRelatedList', $portlet->viewType);
     $this->assertEquals($user->id, $portlet->user->id);
     $view = $portlet->getView();
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:27,代碼來源:ContractsRelatedListPortletTest.php

示例10: showGlobalView

 /**
  * Show the central global view
  **/
 static function showGlobalView()
 {
     $showticket = haveRight("show_all_ticket", "1");
     echo "<table class='tab_cadre_central'><tr>";
     echo "<td class='top'><br>";
     echo "<table >";
     if ($showticket) {
         echo "<tr><td class='top' width='450px'>";
         Ticket::showCentralCount();
         echo "</td></tr>";
     }
     if (haveRight("contract", "r")) {
         echo "<tr><td class='top' width='450px'>";
         Contract::showCentral();
         echo "</td></tr>";
     }
     echo "</table></td>";
     if (haveRight("logs", "r")) {
         echo "<td class='top' width='450px'>";
         //Show last add events
         Event::showForUser($_SESSION["glpiname"]);
         echo "</td>";
     }
     echo "</tr></table>";
     if ($_SESSION["glpishow_jobs_at_login"] && $showticket) {
         echo "<br>";
         Ticket::showCentralNewList();
     }
 }
開發者ID:ryukansent,項目名稱:Thesis-SideB,代碼行數:32,代碼來源:central.class.php

示例11: find_contract_team

 public function find_contract_team()
 {
     $conts = Contract::find_by_sql("SELECT * FROM contracts WHERE player={$this->id} AND expiry>" . time() . " AND term=0 ORDER BY date_of_reg DESC");
     if (isset($conts)) {
         return Team::find_by_id($conts[0]->team);
     } else {
         return NULL;
     }
 }
開發者ID:kunal-bajpai,項目名稱:gfa,代碼行數:9,代碼來源:player.php

示例12: del

 function del($ctx)
 {
     $id = intval($_GET['id']);
     $contract = Contract::get($id);
     if ($contract) {
         $contract->set_del();
     }
     _redirect(_list_url());
 }
開發者ID:zxw5775,項目名稱:yuhunclub,代碼行數:9,代碼來源:contract.php

示例13: delete

 /**
  * 
  * @param type $_id
  * @return \Illuminate\Http\Response Description
  */
 public function delete($_id)
 {
     $contract = Contract::find($_id);
     $response = array('status' => false, '_id' => $_id);
     if ($contract->delete()) {
         $response['status'] = true;
     }
     $headers = array('Content-type' => 'application/json');
     return \Illuminate\Http\Response::create($response, 200, $headers);
 }
開發者ID:ma7euus,項目名稱:test,代碼行數:15,代碼來源:ContractController.php

示例14: scoreOnSaveModel

 /**
  * (non-PHPdoc)
  * @see GamificationRules::scoreOnSaveModel()
  */
 public function scoreOnSaveModel(CEvent $event)
 {
     parent::scoreOnSaveModel($event);
     if (array_key_exists('value', $event->sender->stage->originalAttributeValues) && $event->sender->stage->value == Contract::getStageClosedWonValue()) {
         $scoreType = static::SCORE_TYPE_WIN_CONTRACT;
         $category = static::SCORE_CATEGORY_WIN_CONTRACT;
         $gameScore = GameScore::resolveToGetByTypeAndPerson($scoreType, Yii::app()->user->userModel);
         $gameScore->addValue();
         $saved = $gameScore->save();
         if (!$saved) {
             throw new FailedToSaveModelException();
         }
         GamePointUtil::addPointsByPointData(Yii::app()->user->userModel, static::getPointTypeAndValueDataByCategory($category));
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:19,代碼來源:ContractGamificationRules.php

示例15: login

 public function login()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         /* Hypothetical Data */
         $loginUserEmail = $_REQUEST['email'];
         $loginUserPass = $_REQUEST['pass'];
         $loginUserIp = $_SERVER['REMOTE_ADDR'];
         $loginDateTime = date('Y-m-d H:i:s');
         try {
             $contract = new Contract();
             $contract->term('userEmail', $loginUserEmail)->email()->metOrThrow();
             $contract->term('userPass', $loginUserPass)->alphaNumeric()->length(8, 16)->metOrThrow();
             $contract->term('userIp', $loginUserPass)->ip()->metOrThrow();
             $contract->term('dateTime', $loginDateTime)->datetime()->metOrThrow();
             /* Get User For Login */
             $user = $userModel->getUser($userEmail, $userPass);
             $contract->term('user', $user)->arraylist()->element('id')->id()->end()->element('active')->equals(1)->end()->metOrThrow();
             $loginUserId = $user['id'];
             /* Proceed Safely to Model for Storage of User Login */
             $logged = $userModel->login($loginUserId, $loginUserIp, $loginDateTime);
             $contract->term('userLogged', $logged)->boolean()->equals(TRUE)->metOrThrow();
         } catch (Contract_Exception $e) {
             /* Collect error messages from contract exception */
             $messages = array();
             switch ($e->term) {
                 case 'userEmail':
                     $messages[] = 'Please enter an email address.';
                     break;
                 case 'userPass':
                     $messages[] = 'Please enter a password.';
                     break;
                 case 'userIp':
                     $messages[] = 'Please enter a valid ip address.';
                     break;
                 case 'dateTime':
                     $messages[] = 'Please enter a valid date time.';
                     break;
                 case 'user':
                     $messages[] = 'Please enter a valid user.';
                     break;
                 case 'userLogged':
                     $messages[] = 'Sorry. You could not be logged in.';
                     break;
                 default:
                     $messages[] = 'We do not get it either!';
                     break;
             }
         }
     }
 }
開發者ID:jeisc,項目名稱:PHP-Contract,代碼行數:50,代碼來源:Controller.php


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