当前位置: 首页>>代码示例>>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;未经允许,请勿转载。