コード例 #1
0
 public static function fromMachine($machine_id, $mode_id = 0)
 {
     $retrigger = new RetriggerController();
     $mode = new Mode($mode_id);
     $qTask = mysql_query("SELECT * FROM control_tasks WHERE machine_id = {$machine_id}") or die(mysql_error());
     while ($task = mysql_fetch_object($qTask)) {
         if (!($mode_id == 0 || $task->mode_id == 0 || $task->mode_id == $mode_id)) {
             continue;
         }
         if ($retrigger->unit_id != 0 && $retrigger->unit_id != $task->control_unit_id) {
             throw new Exception("Only one machine allowed.");
         }
         $retrigger->unit_id = $task->control_unit_id;
         $available_at = 0;
         if ($task->delay) {
             $available_at = $task->last_scheduled + $task->delay;
         }
         $task = new ManipulateTask($task->task, $available_at);
         if ($mode_id != 0) {
             $task->update_modes(array($mode->mode()));
         }
         $retrigger->tasks[] = $task;
     }
     return $retrigger;
 }
コード例 #2
0
ファイル: at_home.php プロジェクト: nawrasg/Atlantis
function update($arr)
{
    if (isset($arr['alarm'])) {
        $alarm = new Alarm();
        if ($arr['alarm'] == 'true') {
            $val = true;
            $alarm->on();
        } else {
            $val = false;
            $alarm->off();
        }
        if ($alarm->isOn() == $val) {
            http_response_code(202);
        } else {
            http_response_code(400);
        }
    }
    if (isset($arr['mode'])) {
        $mode_value = $arr['mode'];
        $mode = new Mode();
        switch ($mode_value) {
            case Mode::DAY:
            case Mode::NIGHT:
            case Mode::AWAY:
                $mode->setMode($mode_value);
                http_response_code(202);
                return array('mode' => $mode_value);
        }
    }
}
コード例 #3
0
ファイル: Training.php プロジェクト: eridal/vindinium
 /**
  * @param int $turns [optional] The number of turns you want to play.
  *                   If you don't specify this parameter, 300 turns will be played.
  *
  * @param string $map [optional] The map id corresponding to the map you want to use.
  *                    Possible values are: m1, m2, m3, m4, m5, m6.
  *                    If you don't specify this parameter, a random map will be generated for you.
  *
  * @link https://github.com/ornicar/vindinium/blob/master/app/Maps.scala
  */
 function __construct($turns = null, $map = null)
 {
     $params = null;
     $turns and $params['turns'] = $turns;
     $map and $params['map'] = $map;
     parent::__construct(self::$PATH, $params);
 }
コード例 #4
0
ファイル: ScanRequest.php プロジェクト: bluGill/scanserv
 public function Validate()
 {
     $errors = array();
     if (!Mode::isValidValue($this->mode)) {
         array_push($errors, "Invalid mode: " . $this->mode);
     }
     if (!is_int($this->width)) {
         array_push($errors, "Invalid width: " . $this->width);
     }
     if (!is_int($this->height)) {
         array_push($errors, "Invalid height: " . $this->height);
     }
     if (!is_int($this->top)) {
         array_push($errors, "Invalid top: " . $this->top);
     }
     if (!is_int($this->left)) {
         array_push($errors, "Invalid left: " . $this->left);
     }
     if (!is_int($this->brightness)) {
         array_push($errors, "Invalid brightness: " . $this->brightness);
     }
     if (!is_int($this->contrast)) {
         array_push($errors, "Invalid contrast: " . $this->contrast);
     }
     if ($this->top + $this->height > Config::MaximumScanHeightInMm) {
         array_push($errors, "Top + height exceed maximum dimensions");
     }
     /////////// MORE HERE ///////////////
     /////////////////////////////////////
     return $errors;
 }
コード例 #5
0
 public function adminShowCustomerForm()
 {
     Larasset::start('header')->css('bootstrap-datepicker');
     Larasset::start('footer')->js('bootstrap-datepicker');
     $data['modes'] = Mode::listModes();
     return View::make('customerform', $data);
 }
コード例 #6
0
 public function forMode($mode_id)
 {
     $mode = Mode::FromId($mode_id);
     $vendor = Vendor::FromId($mode->vendor_id());
     $url = $vendor->csetURL();
     if (strpos($url, "hg.mozilla.org") !== false) {
         return new HGWeb($url);
     }
     throw new Exception("Not implemented version control system.");
 }
コード例 #7
0
ファイル: HomeController.php プロジェクト: sliekasirdis79/POS
 public function show()
 {
     //Artisan::call('db:dump');
     //tt( Receipt::find(2)->user()->get()->toArray() );
     Larasset::start('footer')->js('jquery-cookies', 'bootstrap_editable');
     $modesArr = Mode::listModes();
     //Cartsession::set();
     foreach ($modesArr as $key => $value) {
         @($data['str_modes'] .= ucwords($value) . ':' . $key . ',');
     }
     $this->layout->title = Systemsetting::getx('name') . ' - Home';
     $this->layout->content = View::make('frontpage', $data);
 }
コード例 #8
0
ファイル: CBC.php プロジェクト: chansolo/TeamPass
 /**
  * Destructor
  *
  * @return void
  */
 public function __destruct()
 {
     parent::__destruct();
 }
コード例 #9
0
	<td><span class="bolder"><i class="icon-time bigger-110 hidden-phone"></i> {{ng_datetime_format2($v[0]['created_at'])}}</span></td>
	<td colspan="7"><span class="bolder"><a href="#myModal" data-rel='popover' data-url={{URL::route('popoverReceiptPreview', array($groupBy))}}>{{Receipt::buildReceipt($groupBy)}}</a></span></td>
	<td><i class="icon-user bigger-110 hidden-phone"></i> {{User::getUsernameByID($v[0]['user_id'], false)}}</td>
	</tr>
		@foreach($v as $history)
			<tr>
				<td colspan="2"></td>
				<td>{{ ucwords($history['product']['name']) }}</td>
				<td>{{currency()}}{{format_money($history['unitprice'])}}k</td>
				<td>{{$history['quantity']}}</td>
				<td>{{$history['discount']}}%</td>
				<td>{{currency()}}{{format_money($history['total_unitprice'])}}k</td>

					<?php 
if ($history['product']['categories']['type'] === 'service') {
    $modex = 'Services';
} else {
    $modex = Mode::getModeNameFromID($history['mode_id']);
}
?>

				<td colspan="2">{{ucwords($modex)}}</td>
			</tr>
		@endforeach
	@endforeach

@else
	<tr>
		<td colspan="9" class="center"> <h2 class="lighter small"> NO SALE HISTORY : [ <small class="blue datera">{{display_date_range($fromdate, $todate)}}</small> ]</h2> </td>
	</tr>
@endif
コード例 #10
0
ファイル: atlantis.php プロジェクト: nawrasg/Atlantis
function checkModeHours()
{
    $settings = new Settings();
    if ($settings->getSettings('Mode', 'nightAuto')) {
        $mode = new Mode();
        $from = $settings->getSettings('Mode', 'nightFrom');
        $to = $settings->getSettings('Mode', 'nightTo');
        if (time() > strtotime($from) && $mode->getMode() == Mode::DAY) {
            $mode->setMode(Mode::NIGHT);
        } else {
            if (time() < strtotime($from) && time() > strtotime($to) && $mode->getMode() == Mode::NIGHT) {
                $mode->setMode(Mode::DAY);
            }
        }
    }
}
コード例 #11
0
ファイル: Xrandr.php プロジェクト: LordOfTheRats/php_xrandr
 /**
  * Add a custom mode to an output
  *
  * @param Output $output
  * @param Mode   $mode
  *
  * @return bool
  */
 public function addMode($output, $mode)
 {
     exec(Xrandr::XRANDR_BIN . " --addmode {$output->getName()} {$mode->getName()}", $output, $exitcode);
     if ($exitcode != 0) {
         return false;
     }
     return 0;
 }
コード例 #12
0
ファイル: Arena.php プロジェクト: eridal/vindinium
 function __construct()
 {
     parent::__construct(self::$PATH);
 }
コード例 #13
0
 private function _stockLog($stocklog, $product)
 {
     $stocklog->product_id = Input::get('pk');
     $stocklog->user_name = Auth::user()->username;
     $stocklog->brand_name = $product->brand->name;
     $stocklog->productcategory_name = $product->categories->name;
     $stocklog->product_name = $product->name;
     $stocklog->mode_id = Mode::getModeIDFromName(Input::get('mode'));
     $stocklog->updated_quantity = $product->quantity;
     $stocklog->costprice = $product->costprice;
     $mode = Input::get('mode');
     $modeprice = $mode . '_price';
     $modediscount = $mode . '_discount';
     $modediscountedprice = $mode . '_discountedprice';
     $modetotalprice = $mode . '_totalprice';
     $stocklog->unitprice = $product->{$modeprice};
     $stocklog->unitprice_discounted = $product->{$modediscount};
     $stocklog->discount = $product->{$modediscountedprice};
     $stocklog->total_price = $product->{$modetotalprice};
     $stocklog->save();
 }
コード例 #14
0
ファイル: UPDATE.php プロジェクト: stoklund/arewefastyet
// (when status equals 1).
if (GET_string("run") == 'finish') {
    $run_id = GET_int('runid');
    $status = GET_int('status');
    $run = new Run($run_id);
    if ($run->isFinished() || $run->hasError()) {
        throw new Error("Run was already finished or error'ed");
    }
    $error = GET_string('error');
    $run->finish($status, $error);
    die;
}
if (GET_string("run") == 'addEngine') {
    $run = new Run(GET_int('runid'));
    $revision = GET_string('cset');
    $mode = Mode::FromMode(GET_string('name'));
    if ($run->isFinished() || $run->hasError()) {
        throw new Exception("Run was already finished or error'ed");
    }
    if ($run->isOutOfOrder()) {
        // out of order builds cannot add extra modes. The available
        // mode have already been added.
        if (!Build::withRunAndMode($run->id, $mode->id)) {
            $run->finish(0, "Tried to add extra modes to out of order run.");
        }
        die;
    }
    Build::insert($run, $mode->id, $revision);
    die;
}
// Report that a slave is still awake when there are no benchmarks results
コード例 #15
0
 public function modeID($salesmodename)
 {
     $name = str_replace(' ', '', $salesmodename);
     $name = strtolower($name);
     return Mode::getModeIDFromName($name);
 }
コード例 #16
0
            default:
                throw new \InvalidArgumentException();
        }
    }
    /**
     * @param version version in question
     * @return number of bits used, in this QR Code symbol {@link Version}, to encode the
     *         count of characters that will follow encoded in this Mode
     */
    public function getCharacterCountBits($version)
    {
        $number = $version->getVersionNumber();
        $offset = 0;
        if ($number <= 9) {
            $offset = 0;
        } else {
            if ($number <= 26) {
                $offset = 1;
            } else {
                $offset = 2;
            }
        }
        return $this->characterCountBitsForVersions[$offset];
    }
    public function getBits()
    {
        return $this->bits;
    }
}
Mode::Init();
コード例 #17
0
ファイル: dashboard.php プロジェクト: arai-a/arewefastyet
echo "<th>Machine and mode";
echo "<th>Status";
echo "<th>Queue";
echo "<th>Last finished task";
echo "</thead>";
$qUnits = mysql_query("SELECT * FROM control_unit");
while ($unit = mysql_fetch_object($qUnits)) {
    echo "<tr><td>" . $unit->id;
    $qTasks = mysql_query("SELECT * FROM control_tasks WHERE control_unit_id =" . $unit->id) or die(mysql_error());
    if (mysql_num_rows($qTasks) == 0) {
        echo "<td>/";
    } else {
        echo "<td>";
        while ($task = mysql_fetch_object($qTasks)) {
            $machine = Machine::FromId($task->machine_id);
            $mode = Mode::FromId($task->mode_id);
            echo $machine->description();
            echo $mode ? " with " . $mode->name() : "";
            echo "<br>";
        }
    }
    $queue = new TaskQueue($unit->id);
    echo "<td>";
    if ($queue->has_active_task()) {
        $active = $queue->get_active_task();
        echo "running";
        echo "<span title='" . date("G:i d/m/Y", $active->start_time()) . "'> started " . time_ago($active->start_time()) . " ago</span>";
    } else {
        echo "not running";
    }
    echo "<td>";
コード例 #18
0
ファイル: Output.php プロジェクト: LordOfTheRats/php_xrandr
 /**
  * Set the output mode
  *
  * @param Mode $mode Mode to be switched to
  *
  * @return boolean
  */
 public function setMode($mode)
 {
     return $this->_executeCommand("--mode {$mode->getName()}");
 }