示例#1
0
 public function actionUser_rod_edit($user_id, $rod_id)
 {
     if (Yii::$app->user->isGuest) {
         throw new \cs\web\Exception('Вы не можете редактировать данные');
     }
     if (Yii::$app->user->id != $user_id) {
         throw new \cs\web\Exception('Вы не можете редактировать чужие данные');
     }
     $user = UserRod::find(['user_id' => $user_id, 'rod_id' => $rod_id]);
     if (is_null($user)) {
         $user = UserRod::insert(['user_id' => $user_id, 'rod_id' => $rod_id]);
     }
     $path = $user->getRodPath();
     $breadcrumbs = [];
     foreach ($path as $i) {
         $breadcrumbs[] = ['label' => is_null($i['name']) ? '?' : $i['name'], 'url' => ['site/user_rod_edit', 'user_id' => $user_id, 'rod_id' => $i['id']]];
     }
     $model = new \app\models\Form\UserRod($user->getFields());
     if ($model->load(Yii::$app->request->post()) && $model->update()) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render(['model' => $model, 'breadcrumbs' => $breadcrumbs]);
     }
 }
示例#2
0
for ($i = 0; $i < 4; $i++) {
    $points[] = [64 + 128 * $i, 155, 16];
}
for ($i = 0; $i < 8; $i++) {
    $points[] = [32 + 64 * $i, 195, 2];
}
for ($i = 0; $i < 16; $i++) {
    $points[] = [16 + 32 * $i, 204, 2];
}
for ($i = 0; $i < 32; $i++) {
    $points[] = [8 + 16 * $i, 213, 2];
}
for ($i = 0; $i < 64; $i++) {
    $points[] = [4 + 8 * $i, 221, 2];
}
$rod = \app\models\UserRod::query(['user_id' => $user->getId()])->all();
foreach ($rod as $i) {
    $points[$i['rod_id']][] = $i;
}
?>
            <map name="Map">
                <?php 
foreach ($points as $key => $point) {
    ?>
                    <area
                        class="rectTitle"
                        shape="rect"
                        title="<?php 
    echo getName($points[$key]);
    ?>
"