本文整理汇总了PHP中Change类的典型用法代码示例。如果您正苦于以下问题:PHP Change类的具体用法?PHP Change怎么用?PHP Change使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Change类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
public function process(&$return, $req)
{
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
$cf->setIsExecuted(true);
$return['data'] = $cf->getAsyncStatus();
}
开发者ID:CoreylDagget,项目名称:dbc,代码行数:7,代码来源:ActionMarkAsExecuted.class.php
示例2: process
public function process(&$return, $req)
{
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
//only if the setting api_execute_async is true and execution_mode is web, then execute it async
$async = $this->settings->getApiExecuteAsync() && DBC_EXECUTION_MODE == 'web';
$return['data'] = $cf->executeSql($async);
}
开发者ID:CoreylDagget,项目名称:dbc,代码行数:8,代码来源:ActionExecuteSql.class.php
示例3: test_for_pennies
function test_for_pennies()
{
//Arrange
$test_user_input = new Change();
$user_change = 4;
//Act
$result = $test_user_input->giveChange($user_change);
//Assert
$this->assertEquals([0, 0, 0, 4], $result);
}
开发者ID:jsween,项目名称:change_machine_php,代码行数:10,代码来源:AnagramTest.php
示例4: test_getPennies
function test_getPennies()
{
// Arrange
$new_Change = new Change();
$input = 46;
// Act
$result = $new_Change->makeChange($input);
// Assert
$this->assertEquals("quarters:1 dimes:2 nickels:0 pennies:1", $result);
}
开发者ID:eddieduro,项目名称:change-calc-php,代码行数:10,代码来源:ChangeTest.php
示例5: test_calculateOneQuarterOneDimeOneNickelFourPennies
function test_calculateOneQuarterOneDimeOneNickelFourPennies()
{
//Arrange
$test_Change = new Change();
$input = 44;
//Act
$result = $test_Change->calculateChange($input);
//Assert
$this->assertEquals(array('pennies' => 4, 'nickels' => 1, 'dimes' => 1, 'quarters' => 1), $result);
}
开发者ID:Jordan-Meier,项目名称:coin-counter-PHP,代码行数:10,代码来源:ChangeTest.php
示例6: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
if (!parent::canReadITILItem()) {
return false;
}
$change = new Change();
if ($change->getFromDB($this->fields['changes_id'])) {
return Session::haveRight('change', UPDATE) || Session::haveRight('change', Change::READMY) && ($change->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $change->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']));
}
return false;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:16,代码来源:changetask.class.php
示例7: run
public function run($context)
{
$changes = changes_eurotlx();
$change = new Change();
$change->data = date('Y-m-d H:i:s');
foreach ($changes as $key => $val) {
$change->{$key} = $val;
}
$change->_force_create = TRUE;
$change->save();
printf("%s saved currency change rates\n", get_called_class());
}
开发者ID:emeraldion,项目名称:creso,代码行数:12,代码来源:eurotlx_exchange_rate_fetcher_agent.php
示例8: _populate_transactions
function _populate_transactions()
{
$conn = $this->get_connection();
if (count($this->transactions) > 0) {
foreach ($this->transactions as $transaction) {
$transaction->stock = new Stock();
$transaction->stock->find_by_id($transaction->isin);
$transaction->importo = 0;
$parts = $transaction->find_all(array('where_clause' => "`negot_id` = '{$conn->escape($transaction->negot_id)}'"));
if (count($parts) > 0) {
foreach ($parts as $part) {
$importo = $part->quantita * $part->prezzo;
$importo /= $transaction->stock->divisa == 'USD' ? Change::usd2eur($part->data) : 1;
$importo *= $part->azione == 'acquisto' ? -1 : 1;
$importo /= $transaction->stock->tipo == 'obbligazione' ? 100 : 1;
$comm = abs($importo) * $this->preference->comm_percent;
if (strtotime($part->data) >= strtotime("2007-08-01")) {
$comm = $comm > $this->preference->comm_percent_min ? $comm : $this->preference->comm_percent_min;
}
$importo -= $comm;
$importo -= $this->preference->comm_fissa;
$transaction->importo += $importo;
}
}
$this->bilancio += $transaction->importo;
}
}
}
开发者ID:emeraldion,项目名称:creso,代码行数:28,代码来源:ricavi_controller.php
示例9: importo_eur
public function importo_eur()
{
if (!isset($this->importo_eur)) {
$this->importo_eur = Change::convert($this->importo, $this->stock->divisa, date('Y-m-d', $this->timestamp));
}
return $this->importo_eur;
}
开发者ID:emeraldion,项目名称:creso,代码行数:7,代码来源:payment.php
示例10: roi_with_timeline
public static function roi_with_timeline($isin, $username, $month_from, $month_to)
{
$conn = Db::get_connection();
$stock = new Stock();
if (!$stock->find_by_id($isin)) {
return;
}
$portfolio_stock_factory = new PortfolioStock();
$portfolio_stocks = $portfolio_stock_factory->find_all(array('where_clause' => "`isin` = '{$conn->escape($isin)}' " . "AND `utente` = '{$conn->escape($username)}'"));
if (count($portfolio_stocks) == 0) {
return;
}
$portfolio_stock = $portfolio_stocks[0];
$quantita = self::quantita_history($isin, $username, $month_from);
switch ($stock->tipo) {
case 'obbligazione':
$investito = $portfolio_stock->prezzo * $portfolio_stock->quantita / 100;
break;
default:
$investito = $portfolio_stock->prezzo * $portfolio_stock->quantita;
}
$investito = Change::convert($investito, $stock->divisa);
$roi = PianificatoreHelper::roi_with_timeline($isin, $quantita, $month_from, $month_to, $investito);
foreach ($roi->payments as $payment) {
$payment->portfolio_stock = $portfolio_stock;
}
// print_r($roi);
return $roi;
}
开发者ID:emeraldion,项目名称:creso,代码行数:29,代码来源:portfolio_helper.php
示例11: index
/**
* Action methods
*/
public function index()
{
//$this->last = Change::usd2eur();
$conn = $this->get_connection();
$yesterday = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) - 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
$tomorrow = date('Y-m-d', mktime(0, 0, 0, isset($_REQUEST['month']) ? $_REQUEST['month'] : date('m'), (isset($_REQUEST['day']) ? $_REQUEST['day'] : date('d')) + 1, isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y')));
$change = new Change();
$changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `usd2eur` DESC ' . 'LIMIT 1');
$this->day_max = $changes[0];
$changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `usd2eur` ASC ' . 'LIMIT 1');
$this->day_min = $changes[0];
$changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` ASC ' . 'LIMIT 1');
$this->open = $changes[0];
$changes = $change->find_by_query('SELECT `data`, `usd2eur` ' . 'FROM `creso_cambi` ' . "WHERE 1 " . "AND `data` > '{$conn->escape($yesterday)}' " . "AND `data` < '{$conn->escape($tomorrow)}' " . 'ORDER BY `data` DESC ' . 'LIMIT 1');
$this->last = $changes[0];
$this->redirect_to(array_merge($_REQUEST, array('query_string' => $this->request->querystring, 'after' => 300)));
}
开发者ID:emeraldion,项目名称:creso,代码行数:20,代码来源:cambi_controller.php
示例12: _partitionByType
/**
* Returns the changes partitioned by change type.
*
* @return array An array of type => array of changes.
*/
protected function _partitionByType()
{
$types = Change::types();
$result = array_combine(array_keys($types), array_fill(0, count($types), []));
foreach ($this->_changes as $change) {
$result[$change->getType()][] = $change;
}
return array_filter($result);
}
开发者ID:guywithnose,项目名称:release-notes,代码行数:14,代码来源:ChangeList.php
示例13: test_accessors
public function test_accessors()
{
/** === Test Data === */
$CUST_ID = 'cust ID';
$DATE_CHANGED = 'changed at';
$ID = 'id';
$PARENT_ID = 'id';
/** === Call and asserts === */
$this->obj->setCustomerId($CUST_ID);
$this->obj->setDateChanged($DATE_CHANGED);
$this->obj->setId($ID);
$this->obj->setParentId($PARENT_ID);
$this->assertEquals($CUST_ID, $this->obj->getCustomerId());
$this->assertEquals($DATE_CHANGED, $this->obj->getDateChanged());
$this->assertEquals($ID, $this->obj->getId());
$this->assertEquals($PARENT_ID, $this->obj->getParentId());
}
开发者ID:praxigento,项目名称:mobi_mod_mage2_downline,代码行数:17,代码来源:Change_Test.php
示例14: process
public function process(&$return, $req)
{
if (DBC_EXECUTION_MODE != 'cli') {
throw new Exception('runAll is only valid in CLI mode.');
}
parent::process($return, $req);
$cardStack = (array) $return['data'];
$cardStack = array_reverse($cardStack);
//execute in reverse order
$errCount = 0;
$cardCount = sizeof($cardStack);
foreach ($cardStack as $entry) {
try {
$changeFile = $entry['file'];
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile($changeFile);
try {
if (!$cf->doExecuteSql()) {
$errStat = $cf->getAsyncStatus();
throw new Exception($errStat['message']);
}
echo '[DONE] ' . $changeFile . PHP_EOL;
} catch (Exception $e) {
$errCount++;
echo '[FAILED] ' . $changeFile . ' :: ' . $e->getMessage() . PHP_EOL;
echo $cf->getSql() . PHP_EOL;
if (in_array('--force', $req) || in_array('-f', $req)) {
try {
$cf->failedToExecuted();
echo '[IGNORE] ' . $changeFile . PHP_EOL;
} catch (Exception $e) {
echo '[FAILED] ' . $changeFile . ' IGNORE FAILED :: ' . $e->getMessage() . PHP_EOL;
}
}
}
} catch (Execution $e) {
echo '[FAILED] ' . $changeFile . ' Unrecoverable error :: ' . $e->getMessage() . PHP_EOL;
}
if (sizeof($cf->getExecute())) {
echo '[IGNORE] ' . $changeFile . ' PATCHES: ' . implode(', ', $cf->getExecute()) . PHP_EOL;
}
}
$return['data'] = PHP_EOL . '*** FINISHED ' . $cardCount . ' CHANGES' . ($errCount ? ' WITH ' . $errCount . ' FAIL(S)' : ' SUCCESSFULLY');
$return['status'] = 'ok';
}
开发者ID:CoreylDagget,项目名称:dbc,代码行数:45,代码来源:ActionRunAll.class.php
示例15: store
/**
* @param ChangeFile $cf
* @param bool $overwrite
* @throws Exception
*/
public function store(Change $cf, $overwrite = true)
{
if ($cf->getIssueNumber() == '') {
throw new Exception('Issue# is empty.');
}
if ((int) $cf->getIssueCount() == 0) {
throw new Exception('Issue Count is empty.');
}
$filename = $cf->generateFilename($cf->getIssueNumber(), $cf->getIssueCount());
if (!$overwrite) {
if (parent::fileExists($this->getDir(self::FILE_ROOT), $filename)) {
throw new Exception('Change already exists.');
}
}
parent::save($this->getDir(self::FILE_ROOT), $filename, $cf->stringify());
}
开发者ID:CoreylDagget,项目名称:dbc,代码行数:21,代码来源:ChangeFile.class.php
示例16: index
/**
* Action methods
*/
public function index()
{
switch ($_REQUEST['evento']) {
case 'cedola':
$events = $this->get_cedole();
break;
case 'dividendo':
$events = $this->get_dividendi();
break;
case 'rimborso':
$events = $this->get_rimborsi();
break;
default:
if (isset($_REQUEST['isin']) && isset($_REQUEST['use_helper'])) {
$this->roi = PortfolioHelper::roi_with_timeline($_REQUEST['isin'], $_COOKIE['username'], $_REQUEST['month-from'], $_REQUEST['month-to']);
$events = $this->roi->payments;
$this->investito = $this->roi->investito;
$this->totale = $this->roi->totale;
$this->plusminus = $this->roi->plusminus;
} else {
$events = array_merge($this->get_cedole(), $this->get_rimborsi(), $this->get_dividendi());
$this->investito = 0;
$this->plusminus = 0;
foreach ($events as $event) {
$investito = $event->portfolio_stock->prezzo * $event->quantita / 100;
$investito = Change::convert($investito, $event->stock->divisa);
if ($event->tipo == 'rimborso') {
$this->investito += $investito;
}
$plusminus = $event->importo_eur() - $investito;
$this->plusminus += $plusminus;
}
}
}
$this->payments($events);
$this->render(array('action' => 'payments'));
}
开发者ID:emeraldion,项目名称:creso,代码行数:40,代码来源:pagamenti_controller.php
示例17: giveItem
//.........这里部分代码省略.........
$color = $_SESSION['glpiduedatecritical_color'];
} else {
if ($less_warn < $less_warn_limit) {
$color = $_SESSION['glpiduedatewarning_color'];
}
}
//Calculate bar progress
$out .= "<div class='center' style='background-color: #ffffff; width: 100%;\n border: 1px solid #9BA563; position: relative;' >";
$out .= "<div style='position:absolute;'> " . $percentage_text . "%</div>";
$out .= "<div class='center' style='background-color: " . $color . ";\n width: " . $percentage . "%; height: 12px' ></div>";
$out .= "</div>";
return $out;
}
break;
case "glpi_softwarelicenses.number":
if ($data[$num][0]['min'] == -1) {
return __('Unlimited');
}
if (empty($data[$num][0]['name'])) {
return 0;
}
return $data[$num][0]['name'];
case "glpi_auth_tables.name":
return Auth::getMethodName($data[$num][0]['name'], $data[$num][0]['auths_id'], 1, $data[$num][0]['ldapname'] . $data[$num][0]['mailname']);
case "glpi_reservationitems.comment":
if (empty($data[$num][0]['name'])) {
return "<a title=\"" . __s('Modify the comment') . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data["refID"] . "' >" . __('None') . "</a>";
}
return "<a title=\"" . __s('Modify the comment') . "\"\n href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.form.php?id=" . $data['refID'] . "' >" . Html::resume_text($data[$num][0]['name']) . "</a>";
case 'glpi_crontasks.description':
$tmp = new CronTask();
return $tmp->getDescription($data[$num][0]['name']);
case 'glpi_changes.status':
$status = Change::getStatus($data[$num][0]['name']);
return "<img src=\"" . Change::getStatusIconURL($data[$num][0]['name']) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_problems.status':
$status = Problem::getStatus($data[$num][0]['name']);
return "<img src=\"" . Problem::getStatusIconURL($data[$num][0]['name']) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_tickets.status':
$status = Ticket::getStatus($data[$num][0]['name']);
return "<img src=\"" . Ticket::getStatusIconURL($data[$num][0]['name']) . "\"\n alt=\"{$status}\" title=\"{$status}\"> {$status}";
case 'glpi_projectstates.name':
$out = '';
$query = "SELECT `color`\n FROM `glpi_projectstates`\n WHERE `name` = '" . $data[$num][0]['name'] . "'";
foreach ($DB->request($query) as $color) {
$color = $color['color'];
$out = "<div style=\"background-color:" . $color . ";\">";
$name = $data[$num][0]['name'];
if (isset($data[$num][0]['trans'])) {
$name = $data[$num][0]['trans'];
}
if ($itemtype == 'ProjectState') {
$out .= "<a href='" . $CFG_GLPI["root_doc"] . "/front/projectstate.form.php?id=" . $data[$num][0]["id"] . "'>" . $name . "</a></div>";
} else {
$out .= $name . "</div>";
}
}
return $out;
case 'glpi_items_tickets.items_id':
case 'glpi_items_problems.items_id':
if (!empty($data[$num])) {
$items = array();
foreach ($data[$num] as $key => $val) {
if (is_numeric($key)) {
if (!empty($val['itemtype']) && ($item = getItemForItemtype($val['itemtype']))) {
if ($item->getFromDB($val['name'])) {
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:search.class.php
示例18: post_deleteFromDB
function post_deleteFromDB()
{
global $CFG_GLPI;
$donotif = $CFG_GLPI["use_mailing"];
// if (isset($this->input["_no_notif"]) && $this->input["_no_notif"]) {
// $donotif = false;
// }
$item = $this->getConnexityItem(static::$itemtype_1, static::getItilObjectForeignKey());
if ($item instanceof CommonDBTM) {
if ($item->countSuppliers(CommonITILActor::ASSIGN) == 0 && $item->countUsers(CommonITILActor::ASSIGN) == 0 && $item->countGroups(CommonITILActor::ASSIGN) == 0 && $item->fields['status'] != CommonITILObject::CLOSED && $item->fields['status'] != CommonITILObject::SOLVED) {
$status = CommonITILObject::INCOMING;
if (in_array($item->fields['status'], Change::getNewStatusArray())) {
$status = $item->fields['status'];
}
$item->update(array('id' => $this->fields[static::getItilObjectForeignKey()], 'status' => $status));
} else {
$item->updateDateMod($this->fields[static::getItilObjectForeignKey()]);
if ($donotif) {
$options = array();
if (isset($this->fields['users_id'])) {
$options = array('_old_user' => $this->fields);
}
NotificationEvent::raiseEvent("update", $item, $options);
}
}
}
parent::post_deleteFromDB();
}
开发者ID:jose-martins,项目名称:glpi,代码行数:28,代码来源:commonitilactor.class.php
示例19: displayTabContentForItem
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
{
switch ($item->getType()) {
case 'Change':
self::showForChange($item);
break;
default:
Change::showListForItem($item);
}
return true;
}
开发者ID:stweil,项目名称:glpi,代码行数:11,代码来源:change_item.class.php
示例20: getDatasForObject
//.........这里部分代码省略.........
$tmp = array();
$tmp['##linkedticket.id##'] = $data['tickets_id'];
$tmp['##linkedticket.link##'] = Ticket_Ticket::getLinkName($data['link']);
$tmp['##linkedticket.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "ticket_" . $data['tickets_id']);
$tmp['##linkedticket.title##'] = $linkedticket->getField('name');
$tmp['##linkedticket.content##'] = $linkedticket->getField('content');
$datas['linkedtickets'][] = $tmp;
}
}
}
$datas['##ticket.numberoflinkedtickets##'] = count($datas['linkedtickets']);
$restrict = "`tickets_id`='" . $item->getField('id') . "'";
$problems = getAllDatasFromTable('glpi_problems_tickets', $restrict);
$datas['problems'] = array();
if (count($problems)) {
$problem = new Problem();
foreach ($problems as $data) {
if ($problem->getFromDB($data['problems_id'])) {
$tmp = array();
$tmp['##problem.id##'] = $data['problems_id'];
$tmp['##problem.date##'] = $problem->getField('date');
$tmp['##problem.title##'] = $problem->getField('name');
$tmp['##problem.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "problem_" . $data['problems_id']);
$tmp['##problem.content##'] = $problem->getField('content');
$datas['problems'][] = $tmp;
}
}
}
$datas['##ticket.numberofproblems##'] = count($datas['problems']);
$restrict = "`tickets_id`='" . $item->getField('id') . "'";
$changes = getAllDatasFromTable('glpi_changes_tickets', $restrict);
$datas['changes'] = array();
if (count($changes)) {
$change = new Change();
foreach ($changes as $data) {
if ($change->getFromDB($data['changes_id'])) {
$tmp = array();
$tmp['##change.id##'] = $data['changes_id'];
$tmp['##change.date##'] = $change->getField('date');
$tmp['##change.title##'] = $change->getField('name');
$tmp['##change.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "change_" . $data['changes_id']);
$tmp['##change.content##'] = $change->getField('content');
$datas['changes'][] = $tmp;
}
}
}
$datas['##ticket.numberofchanges##'] = count($datas['changes']);
if (!isset($options['additionnaloption']['show_private']) || !$options['additionnaloption']['show_private']) {
$restrict .= " AND `is_private` = '0'";
}
$restrict .= " ORDER BY `date` DESC, `id` ASC";
//Followup infos
$followups = getAllDatasFromTable('glpi_ticketfollowups', $restrict);
$datas['followups'] = array();
foreach ($followups as $followup) {
$tmp = array();
$tmp['##followup.isprivate##'] = Dropdown::getYesNo($followup['is_private']);
$tmp['##followup.author##'] = Html::clean(getUserName($followup['users_id']));
$tmp['##followup.requesttype##'] = Dropdown::getDropdownName('glpi_requesttypes', $followup['requesttypes_id']);
$tmp['##followup.date##'] = Html::convDateTime($followup['date']);
$tmp['##followup.description##'] = $followup['content'];
$datas['followups'][] = $tmp;
}
$datas['##ticket.numberoffollowups##'] = count($datas['followups']);
// Approbation of solution
$restrict .= " LIMIT 1";
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:notificationtargetticket.class.php
注:本文中的Change类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论