Exemplo n.º 1
0
 public function test_SerialPortList_Windows()
 {
     $this->assertTrue(It::isWindows());
     Yii::app()->params['show_fake_com_ports'] = false;
     $result = SysFunc::getAvailableComPortsList();
     $expected = array('COM1' => 'Последовательный порт', 'COM2' => 'Последовательный порт');
     $this->assertEquals($expected, $result);
 }
Exemplo n.º 2
0
 public function actionStationSave()
 {
     $form = Station::model()->findByPk(isset($_REQUEST['station_id']) ? intval($_REQUEST['station_id']) : null);
     if (is_null($form)) {
         $form = new Station();
         $form->communication_type = 'direct';
         $form->station_gravity = array_shift(array_keys(\yii::app()->params['station_gravity']));
     }
     $form->wmo_block_number = $form->wmo_block_number > 0 ? $form->wmo_block_number : '';
     $form->wmo_member_state_id = $form->wmo_member_state_id > 0 ? $form->wmo_member_state_id : '';
     $form->national_aws_number = $form->national_aws_number > 0 ? $form->national_aws_number : '';
     if (Yii::app()->request->isPostRequest && isset($_POST['Station'])) {
         $form->attributes = $_POST['Station'];
         if ($form->save()) {
             It::memStatus($form->isNewRecord ? 'station_added' : 'station_updated');
             $this->redirect($this->createUrl('admin/StationSave', array('station_id' => $form->station_id)));
         }
     }
     $this->render('station_save', array('form' => $form, 'comports_list' => SysFunc::getAvailableComPortsList()));
 }
Exemplo n.º 3
0
<div class="middlenarrow">
    <h1> Setup SMS Port </h1>


    <p><b>Selected Port:</b> <?php 
echo $SMSCOMPort->COM;
?>
</p> <br/>
    <form action="<?php 
echo Yii::app()->urlManager->createUrl('admin/smscommandsetup');
?>
" method="POST">
        <?php 
echo CHtml::DropDownList('setup_com', $SMSCOMPort->COM, SysFunc::getAvailableComPortsList());
?>
 <br> <br>
        <input type="submit" value="Apply"/>
    </form>

</div>
Exemplo n.º 4
0
 public static function fullCopy($source, $target)
 {
     if (is_dir($source)) {
         if (!is_dir($target)) {
             @mkdir($target);
         }
         $d = dir($source);
         while (FALSE !== ($entry = $d->read())) {
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             $Entry = $source . '/' . $entry;
             if (is_dir($Entry)) {
                 SysFunc::fullCopy($Entry, $target . '/' . $entry);
                 continue;
             }
             copy($Entry, $target . '/' . $entry);
         }
         $d->close();
     } else {
         copy($source, $target);
     }
 }
Exemplo n.º 5
0
 public static function getLinuxComName($com)
 {
     $comsArray = SysFunc::getAvailableComPortsList();
     return $comsArray[$com];
 }