Exemple #1
0
 public function actionAjaxentermsg($id = null)
 {
     if (isset($_GET['text'])) {
         if (!Yii::$app->user->isGuest) {
             $model = new Msgs();
             $model->admin_id = Yii::$app->user->id;
             $model->text = $_GET['text'];
             $model->time = time();
             $model->unit_type = 1;
             $model->unit_id = $id;
             if ($model->save()) {
                 echo '<tr>
                     <th>' . User::name(Yii::$app->user->id) . '<br/>
                         <span style="font-size: xx-small; color: #c0c0c0;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
                 </tr>';
             } else {
                 echo '== данные не сохранились... ==';
             }
         } else {
             echo '<tr class="grey">
                     <th>
                         Гость<br/>
                         <span style="font-size: xx-small;">(' . date('d.m.y', time()) . ')</span>
                     </th>
                     <td>' . nl2br(HTML::encode($_GET['text'])) . '</td>
             </tr>';
         }
     } else {
         echo '== данные не получены... ==';
     }
 }
Exemple #2
0
 public function setFilter($post, $db)
 {
     $cid = (int) $post['cid'];
     $fid = (int) $post['fid'];
     $cfh_id = (int) $post['cfh_id'];
     $filter = HTML::encode(trim($post['filter']));
     $fil_id = $db->createCommand("SELECT filter_id FROM idc_categories_filters WHERE filter = :filter")->bindValues([':filter' => $filter])->queryScalar();
     if ($cid && $fid && $filter && $cfh_id) {
         if (!$fil_id) {
             $db->createCommand("UPDATE idc_categories_filters AS cf\n                                        SET cf.filter = :filter\n                                        WHERE cf.filter_id = :fid")->bindValues([':filter' => $filter, ':fid' => $fid])->execute();
         } else {
             $db->createCommand("UPDATE idc_categories_filters_hooks AS cfh\n                                        SET cfh.filter_id = :fil_id\n                                        WHERE cfh.category_id = :cid\n                                        AND cfh.cfh_id = :cfh_id")->bindValues([':cid' => $cid, ':fil_id' => $fil_id, ':cfh_id' => $cfh_id])->execute();
         }
     } elseif ($cid && !$fid && $filter && !$cfh_id) {
         if (!$fil_id) {
             $db->createCommand()->insert('idc_categories_filters', ['filter' => $filter])->execute();
             $fid = $db->getLastInsertID();
         } else {
             $fid = $fil_id;
         }
         $db->createCommand()->insert('idc_categories_filters_hooks', ['category_id' => $cid, 'filter_id' => $fid])->execute();
         $cfh_id = $db->getLastInsertID();
         return ['cfh' => $cid, 'fid' => $fid, 'cfh_id' => $cfh_id];
     }
     return false;
 }
 public function actionIndex($type)
 {
     $dataProvider = new ActiveDataProvider(['query' => Product::find()->where(['product_type' => HTML::encode($type)])]);
     /*
     if(!$dataProvider){
         throw new NotFoundHttpException(\Yii::t('backend', 'Page not found'));
     }
     */
     $name = Product::getProductTypeName2(HTML::encode($type));
     return $this->render('index', ['dataProvider' => $dataProvider, 'type' => $name]);
 }
 public function actionResetpic()
 {
     $a = $_POST['data'];
     $a = HTML::encode($a);
     $user = User::findByUsername(Yii::$app->user->identity->username);
     $user->pic = $a;
     $link = mysqli_connect("localhost", "root", "tttsss17", "ts18web") or die("Could not connect database");
     if (mysqli_query($link, "UPDATE user SET pic = '{$a}'  WHERE username = '******'")) {
         return $this->redirect(['dashboard/index', ['model' => $user]]);
     } else {
         return $this->redirect(['site/index']);
     }
     //(['dashboard/index']);
 }
Exemple #5
0
 public static function name($id = null, $a = 0)
 {
     if ($id == 0) {
         return '<i>Гость</i>';
     }
     $user = User::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
     if ($user == null) {
         return '<i>==не_найден==</i>';
     }
     if ($a == 0) {
         return '<strong>' . HTML::encode($user['username']) . '</strong>';
     }
     if ($a == 1) {
         return '<a href="' . Yii::$app->request->baseUrl . '/user/view/' . $user['id'] . '">' . HTML::encode($user['username']) . '</a>';
     }
     return '<i>==нет_параметра==</i>';
 }
Exemple #6
0
 /**
  * @param $id - id турнира
  * @param int $a - включить ссылку
  * @return string
  */
 public static function name($id, $a = 0)
 {
     if ($id == 0) {
         return '<i>Неизвестный</i>';
     }
     $t = T::findOne(['id' => $id]);
     if ($t == null) {
         return '<i>==не_найден==</i>';
     }
     if ($a == 0) {
         return HTML::encode($t['name']);
     }
     if ($a == 1) {
         return '<a href="' . Yii::$app->request->baseUrl . '/' . $t['id'] . '">' . HTML::encode($t['name']) . '</a>';
     }
     return '<i>==нет_параметра==</i>';
 }
 public function actionAjaxenterchatmain()
 {
     if (isset($_GET['text']) && $_GET['text'] != NULL) {
         $_GET['text'] = substr($_GET['text'], 0, 254);
         if (!Yii::$app->user->isGuest) {
             // проверка на спам.
             $check = Chatmain::findOne(['admin_id' => Yii::$app->user->id]);
             if ($check && $check['time'] < time() - 10) {
                 // создание новой записи
                 $model = new Chatmain();
                 $model->admin_id = Yii::$app->user->id;
                 $model->text = $_GET['text'];
                 $model->time = time();
                 if ($model->save()) {
                     echo '<div>
                     <span>' . User::name(Yii::$app->user->id) . ': </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                 </div>';
                 } else {
                     echo '== данные не сохранились... ==';
                 }
             } else {
                 '<div class="grey">
                     <span>.User::name(Yii::$app->user->id): </span>
                     <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
                     <span> (Антиспам: сообщение не будет сохранено)</span>
                 </div>';
             }
         } else {
             echo '<div class="grey">
                 <span>Гость: </span>
                 <span>' . nl2br(HTML::encode($_GET['text'])) . '</span>
             </div>';
         }
     }
     //else echo '== данные не получены... ==';
 }
Exemple #8
0
 public static function dump($value, $name)
 {
     if (!self::isDebugUser()) {
         return;
     }
     $text = var_export($value, true);
     if (php_sapi_name() == 'cli') {
         return $text;
     }
     $text = preg_replace('/=(>?) \\n */', '=\\1 ', $text);
     $html = HTML::encode($text);
     $expandable_html = self::getExpandButtonHtml('this.nextSibling');
     $expandable_html .= '<span style="display: none">';
     $html = str_replace('{', '{' . $expandable_html, $html);
     $html = str_replace('}', '</span>}', $html);
     $html = str_replace('::__set_state(array(', ':((' . $expandable_html, $html);
     $html = str_replace('))', '</span>))', $html);
     $html = str_replace('array (', 'array (' . $expandable_html, $html);
     $html = preg_replace('/^(\\s*)\\)/m', '$1</span>)', $html);
     return HTML::tag('div', array('class' => 'debug'), HTML::tag('b', null, $name . self::getExpandButtonHtml('this.parentNode.nextSibling')) . HTML::tag('pre', array('style' => 'display: none;'), $html));
 }
Exemple #9
0
                    <td>Посл.изменение</td>
                    </thead>
                    <?php 
foreach (array_reverse($season) as $one) {
    ?>
                        <tr>
                            <td><?php 
    echo $one->id;
    ?>
</td>
                            <td><?php 
    echo T::name($one->t_id, 1);
    ?>
</td>
                            <td><?php 
    echo HTML::encode($one->name);
    ?>
</td>
                            <td><?php 
    echo Season::nets(1, $one->net_type);
    ?>
</td>
                            <td><?php 
    echo User::name($one->admin_id);
    ?>
</td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->time_update);
    ?>
</td>
                        </tr>
Exemple #10
0
                    <?php 
foreach ($users as $one) {
    ?>
                        <tr>
                            <td><?php 
    echo $one->id;
    ?>
</td>
                            <td><a href="<?php 
    echo Yii::$app->request->baseUrl;
    ?>
/user/view/<?php 
    echo $one['id'];
    ?>
" ><?php 
    echo HTML::encode($one->username);
    ?>
</a></td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->created_at);
    ?>
</td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->updated_at);
    ?>
</td>
                        </tr>
                    <?php 
}
?>
                </table>
Exemple #11
0
        <table class="table table-hover">
            <tr>
                <th>รหัส</th>   
                <th>ชื่อตำแหน่ง</th>
                <th>ลบ</th>           
            </tr>
            <?php 
foreach ($positions as $position) {
    ?>
                <tr>
                    <td><?php 
    echo HTML::encode($position['position_id']);
    ?>
</td>
                    <td><?php 
    echo HTML::encode($position['position_name']);
    ?>
</td>
                    <td><a href="<?php 
    echo Url::to(['position/delete', 'id' => Html::encode($position['position_id'])]);
    ?>
">
                            <span class="fa fa-trash text-danger">
                        </a></span></td>
                </tr>
            <?php 
}
?>
        </table>

        <!--ตัวอย่างต้นฉบับ-->
Exemple #12
0
    echo Yii::$app->urlManager->createUrl(['t/createseason']) . '/' . $t['id'];
    ?>
">
                                    (+) добавить новую турнирную сетку
                                </a>
                            </td>
                        <?php 
}
?>
                    </tr>
                </table>

                <?php 
foreach (array_reverse($seasons) as $one) {
    ?>
                    <a style="cursor: pointer;" onclick="show_season(<?php 
    echo $one['id'];
    ?>
)"><?php 
    echo HTML::encode($one['name']);
    ?>
</a>;
                <?php 
}
?>

            </div>
        </td>
    </tr>
</table>
Exemple #13
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\User;
use app\models\Season;
$color_table = '#' . $t['color_table'];
$color_text_unit = '#' . $t['color_text_unit'];
$color_text_time = '#' . $t['color_text_time'];
$color_line = '#' . $t['color_line'];
$color_cell = '#' . $t['color_cell'];
$line = '2px solid' . $color_line;
$this->title = 'Изменение ' . HTML::encode($season['name']) . '(' . HTML::encode($t['name']) . ') | ' . Yii::$app->name;
?>


<style>

    /******** переопределение стилей BOOTSTRAP *********/

    .form-group{
        margin-bottom: 1px;
    }

    /**************************************************/

    .net table{
        width: 100%;
        margin: 0;
        padding: 0;
        background-color: <?php 
Exemple #14
0
    }
    if (trim($season['uuuuunit2']) != null) {
        $s['uuuuunit2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'uuuuunit2" ondblclick="update_cell_u' . $season['id'] . '(\'uuuuunit2\')">' . HTML::encode($season['uuuuunit2']) . '</td><td class="td_score" id="' . $season['id'] . 'ssssscore2" ondblclick="update_cell_s' . $season['id'] . '(\'ssssscore2\')">' . $season['ssssscore2'] . '</td></tr></table></td>';
    } else {
        $s['uuuuunit2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'uuuuunit2" ondblclick="update_cell_u' . $season['id'] . '(\'uuuuunit2\')">' . HTML::encode($season['uuuuunit2']) . '</td><td class="td_score" id="' . $season['id'] . 'ssssscore2" ondblclick="update_cell_s' . $season['id'] . '(\'ssssscore2\')"></td></tr></table></td>';
    }
    $s['unit_winner'] = '<td class="td_unit">' . $season['unit_winner'] . '</td>';
    if (trim($season['unit3place1']) != null) {
        $s['unit3place1'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place1" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place1\')">' . HTML::encode($season['unit3place1']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place1" ondblclick="update_cell_s' . $season['id'] . '(\'score3place1\')">' . $season['score3place1'] . '</td></tr></table></td>';
    } else {
        $s['unit3place1'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place1" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place1\')">' . HTML::encode($season['unit3place1']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place1" ondblclick="update_cell_s' . $season['id'] . '(\'score3place1\')"></td></tr></table></td>';
    }
    if (trim($season['unit3place2']) != null) {
        $s['unit3place2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place2" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place2\')">' . HTML::encode($season['unit3place2']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place2" ondblclick="update_cell_s' . $season['id'] . '(\'score3place2\')">' . $season['score3place2'] . '</td></tr></table></td>';
    } else {
        $s['unit3place2'] = '<td class="td_unit"><table><tr><td class="td_unit0" id="' . $season['id'] . 'unit3place2" ondblclick="update_cell_u' . $season['id'] . '(\'unit3place2\')">' . HTML::encode($season['unit3place2']) . '</td><td class="td_score" id="' . $season['id'] . 'score3place2" ondblclick="update_cell_s' . $season['id'] . '(\'score3place2\')"></td></tr></table></td>';
    }
    $s['unit3place3'] = '<td class="td_unit">' . $season['unit3place3'] . '</td>';
}
////////// SCORE //////////////////////////////////////////////
if (Season::nets()[$season['net_type']]['type'] == 2) {
    $s['score_a1'] = '<td class="td_score" id="' . $season['id'] . 'score_a1" ondblclick="notSendFromGroupCellScore()">' . ($season['score1'] + $season['score2'] + $season['score3']) . '</td>';
    $s['score_a2'] = '<td class="td_score" id="' . $season['id'] . 'score_a2" ondblclick="notSendFromGroupCellScore()">' . ($season['score4'] + $season['score5'] + $season['score6']) . '</td>';
    $s['score_a3'] = '<td class="td_score" id="' . $season['id'] . 'score_a3" ondblclick="notSendFromGroupCellScore()">' . ($season['score7'] + $season['score8'] + $season['score9']) . '</td>';
    $s['score_a4'] = '<td class="td_score" id="' . $season['id'] . 'score_a4" ondblclick="notSendFromGroupCellScore()">' . ($season['score10'] + $season['score11'] + $season['score12']) . '</td>';
    $s['score_b1'] = '<td class="td_score" id="' . $season['id'] . 'score_b1" ondblclick="notSendFromGroupCellScore()">' . ($season['score13'] + $season['score14'] + $season['score15']) . '</td>';
    $s['score_b2'] = '<td class="td_score" id="' . $season['id'] . 'score_b2" ondblclick="notSendFromGroupCellScore()">' . ($season['score16'] + $season['score17'] + $season['score18']) . '</td>';
    $s['score_b3'] = '<td class="td_score" id="' . $season['id'] . 'score_b3" ondblclick="notSendFromGroupCellScore()">' . ($season['score19'] + $season['score20'] + $season['score21']) . '</td>';
    $s['score_b4'] = '<td class="td_score" id="' . $season['id'] . 'score_b4" ondblclick="notSendFromGroupCellScore()">' . ($season['score22'] + $season['score23'] + $season['score24']) . '</td>';
    $s['score_c1'] = '<td class="td_score" id="' . $season['id'] . 'score_c1" ondblclick="notSendFromGroupCellScore()">' . ($season['score25'] + $season['score26'] + $season['score27']) . '</td>';
    $s['score_c2'] = '<td class="td_score" id="' . $season['id'] . 'score_c2" ondblclick="notSendFromGroupCellScore()">' . ($season['score28'] + $season['score29'] + $season['score30']) . '</td>';
Exemple #15
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\User */
$this->title = 'Изменение пользователя: ' . $model->username;
?>

<h1>Изменение пользователя <?php 
echo HTML::encode($model->username);
?>
</h1>

<?php 
$form = ActiveForm::begin();
?>

<?php 
echo $form->field($model, 'username')->textInput();
?>

<div class="form-group">
    <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>

<?php 
ActiveForm::end();
?>
Exemple #16
0
<?php

/* @var $this yii\web\View */
use yii\helpers\Html;
use app\models\User;
//var_dump($news); exit;
?>
<div>
    <div>
        <span><?php 
echo User::name($msg->admin_id);
?>
: </span>
        <span><?php 
echo nl2br(HTML::encode($msg->text));
?>
</span>
    </div>
</div>
Exemple #17
0
                <th>ลบ</th>  
            </tr>
            <?php 
foreach ($persons as $person) {
    ?>
                <tr>
                    <td><?php 
    echo HTML::encode($person['person_id']);
    ?>
</td>
                    <td><?php 
    echo HTML::encode($person['prefix_name']);
    ?>
</td>
                    <td><?php 
    echo HTML::encode($person['person_firstname']);
    ?>
</td>
                    <td><a href="<?php 
    echo Url::to(['person/delete', 'id' => Html::encode($person['person_id'])]);
    ?>
">
                            <span class="fa fa-trash text-danger">
                        </a></span></td>
                </tr>
            <?php 
}
?>
        </table>
    </div>
</div>
Exemple #18
0
 public function actionAjaxupdatecell($id = null)
 {
     //echo $id;
     if ($id != null) {
         $season = Season::findOne($id);
         if ($season != null) {
             $t = T::findOne($season->t_id);
             if ($t != null and $t->admin_id == Yii::$app->user->id) {
                 if (isset($_GET['cell']) and isset($_GET['msg'])) {
                     $cell = $_GET['cell'];
                     $msg = $_GET['msg'];
                     $season[$cell] = $msg;
                     $season['time_update'] = time();
                     if ($season->update()) {
                         echo HTML::encode($msg);
                     } else {
                         echo 'Ошибка! Не сохранилось...';
                     }
                 } else {
                     echo 'Ошибка! Не пришли жанные ячейки и записи...' . $_GET['cell'] . ' ' . $_GET['msg'];
                 }
             } else {
                 echo 'Ошибка! Вы не админ...';
             }
         } else {
             echo 'Ошибка! Сезон не найден...';
         }
     } else {
         echo 'Ошибка! Не пришел id...';
     }
 }
Exemple #19
0
    <tr>
        <td style="width: 60%; padding: 10px; border: 2px solid #39b3d7; vertical-align: top;">
            <table id="msgs" class="tbl_msgs">
                <?php 
foreach ($msgs as $one) {
    ?>
                    <tr>
                        <th><?php 
    echo User::name($one['admin_id']);
    ?>
<br/><span style="font-size: xx-small; color: #c0c0c0;">(<?php 
    echo date('d.m.y', $one['time']);
    ?>
)</th>
                        <td><?php 
    echo nl2br(HTML::encode($one['text']));
    ?>
</td>
                    </tr>
                <?php 
}
?>
            </table>
        </td>
        <td style="width: 40%; padding: 10px; vertical-align: top;">
            <div>
                <textarea id="text_msg" placeholder="Введите новое сообщение... <?php 
if (Yii::$app->user->isGuest) {
    echo '(Вы гость, поэтому сообщение не сохраниться...)';
}
?>
Exemple #20
0
</div>
        </div>
    <?php 
}
?>

    <?php 
if (isset($event)) {
    ?>
        <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="row">
                <div class="col-lg-6 col-md-6 col-sm-6 col-xm-6 div-header-news">
                    Событие | <?php 
    echo date('d.m.y', $event->time);
    ?>
                </div>
                <div class="col-lg-6 col-md-6 col-sm-6 hidden-xs" style="text-align: right; font-weight: normal">
                    <a href="#" onclick="alert('Извините, раздел в разработке.')" style="color: silver; font-weight: lighter">читать все события</a>
                </div>
            </div>
            <div><?php 
    echo nl2br(HTML::encode($event->text));
    ?>
</div>
        </div>
    <?php 
}
?>

</div>
Exemple #21
0
        <table class="table table-hover">
            <tr>
                <th>รหัส</th>   
                <th>ชื่อแผนก</th>
                <th>ลบ</th>           
            </tr>
            <?php 
foreach ($departments as $department) {
    ?>
                <tr>
                    <td><?php 
    echo HTML::encode($department['department_id']);
    ?>
</td>
                    <td><?php 
    echo HTML::encode($department['department_name']);
    ?>
</td>
                    <td><a href="<?php 
    echo Url::to(['department/delete', 'id' => Html::encode($department['department_id'])]);
    ?>
">
                            <span class="fa fa-trash text-danger">
                        </a></span></td>
                </tr>
            <?php 
}
?>
        </table>
    </div>
</div>
Exemple #22
0
    </div>

    <div class="col-lg-3 col-md-3 col-sm-3 col-xm-12">
        <h3>Мои турниры</h3>
        <?php 
if ($ts != null) {
    ?>
            <?php 
    foreach ($ts as $one) {
        ?>
                (ID <?php 
        echo $one['id'];
        ?>
)
                <?php 
        echo Html::a(HTML::encode($one['name']), '/' . $one['id']);
        ?>
                <br />
            <?php 
    }
    ?>
        <?php 
} else {
    ?>
            <span class="grey">Турниры не найдены...</span>
        <?php 
}
?>
    </div>
</div>
</div>