Esempio n. 1
0
function link_to($path, $caption, $options = array())
{
    set_if_not_set($options["goto"], false);
    if (!in_array(substr($path, 0, 7), array("mailto:", "http://", "https:/")) && substr($path, 0, 1) != "#") {
        $path = "/" . $path;
    }
    if (isset($GLOBALS["full_path_links"]) && $GLOBALS["full_path_links"]) {
        $path = full_path($path);
    }
    if ($options["goto"]) {
        $parameters = array_intersect_key($options, array_flip(array("class", "id", "title")));
        return insert_properties_in_html_tag(str_replace("\n", "", $caption), array_merge($parameters, array("onclick" => "goto('" . $path . "')", "style" => "cursor:pointer")));
    } else {
        if (!is_empty($options['modal'])) {
            set_if_not_set($options['modal']['title'], "");
            // The message should be set if the 'modal' options is used, but we provide a default one
            set_if_not_set($options['modal']['message'], " Es-tu sûr de vouloir faire cela ?");
            // A modal toggle should at least be a button and not only a text in a div
            set_if_not_set($options['modal']['class'], "btn");
            $modal_id = is_empty($options['modal']["id"]) ? $options["id"] . "_modal_auto_id" : $options['modal']["id"];
            $button_in_modal = link_to($path, "<div> Confirmer </div>", array("class" => "btn"));
            $content = $options['modal']['message'] . "<div class=\"button-container\">" . $button_in_modal . "</div>";
            $modal = modal($modal_id, array("title" => $options['modal']["title"]), $content);
            return modal_toggle($options["id"], $caption, $options["class"], $modal_id) . "\n" . $modal;
        } else {
            $parameters = is_empty($options["class"]) ? "" : " class=\"" . $options["class"] . "\"";
            $parameters .= is_empty($options["id"]) ? "" : " id=\"" . $options["id"] . "\"";
            $parameters .= is_empty($options["title"]) ? "" : " title=\"" . $options["title"] . "\"";
            return "<a href=\"" . $path . "\"" . $parameters . ">" . $caption . "</a>";
        }
    }
}
 /**
  * delete a command
  *
  * @param $id
  * @return mixed
  */
 public function deleteSchedule($id)
 {
     \ruler()->check($this->permission, ['id' => 'required|exists:schedule,schedule_id'], ['id' => $id]);
     // Récuperation du model
     $schedule = Schedule::find($id);
     $modal = \modal(null, 'Etes vous sûr de vouloir supprimer : <b>' . $schedule->schedule_id . '</b>');
     $button = (new \FrenchFrogs\Form\Element\Button('yes', 'Supprimer !'))->setOptionAsDanger()->enableCallback('delete')->addAttribute('href', action_url(static::class, __FUNCTION__, $id, ['delete' => true]));
     $modal->appendAction($button);
     // enregistrement
     if (\request()->has('delete')) {
         try {
             $schedule->delete();
             \js()->success()->closeRemoteModal()->reloadDataTable();
         } catch (\Exception $e) {
             \js()->error($e->getMessage());
         }
         return \js();
     }
     return response()->modal($modal);
 }
 /**
  * Modal Manager
  *
  * Gestion des reponse ajax qui s'affiche dans une modal
  *
  */
 public function bootModal()
 {
     Response::macro('modal', function ($title, $body = '', $actions = []) {
         if ($title instanceof FrenchFrogs\Modal\Modal\Modal) {
             $modal = $title->enableRemote();
         } elseif ($title instanceof FrenchFrogs\Form\Form\Form) {
             $renderer = configurator()->get('form.renderer.modal.class');
             $modal = $title->setRenderer(new $renderer());
         } else {
             $modal = modal($title, $body, $actions)->enableRemote();
         }
         $modal .= '<script>jQuery(function() {' . js('onload') . '});</script>';
         return $modal;
     });
 }
Esempio n. 4
0
<?php

if (!$ajax) {
    ?>
    
    </div> 

    <?php 
    for ($i = 0; $i < 1; $i++) {
        modal();
    }
    ?>

    <!-- /container -->        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
        <script src="js/vendor/bootstrap.min.js"></script>
        <script src="js/vendor/bootstrap-switch.min.js"></script>
        <script src="js/vendor/bootstrap-contextmenu.js"></script>
        <script src="js/config.js"></script>
        <script src="js/functions.js"></script>
        <script src="js/listsEvents.js"></script>
        <script src="js/panels.js"></script>
        <script src="js/dragdrop.js"></script>
        <script src="js/loader.js"></script>
        <script src="js/main.js"></script>
    </body>
</html>

<?php 
}
Esempio n. 5
0
 /**
  * Suppression d'un utilisateur
  *
  */
 public function deleteUser($id)
 {
     //RULER
     \ruler()->check($this->permission, ['id' => 'exists:user,user_id'], ['id' => $uuid = f($id, 'uuid')]);
     // MODEL
     $model = User::findOrFail($uuid);
     // MODAL
     $modal = \modal(null, 'Etes vous sûr de vouloir supprimer : <b>' . $model->name . '</b>');
     $button = (new \FrenchFrogs\Form\Element\Button('yes', 'Supprimer !'))->setOptionAsDanger()->enableCallback('delete')->addAttribute('href', request()->url() . '?delete=1');
     $modal->appendAction($button);
     // TRAITEMENT
     if (\request()->has('delete')) {
         try {
             $model->delete();
             \js()->success()->closeRemoteModal()->reloadDataTable();
         } catch (\Exception $e) {
             \js()->error($e->getMessage());
         }
         return js();
     }
     return response()->modal($modal);
 }
Esempio n. 6
0
<?php

include "include/db/rooms.php";
include './control/modal.php';
modal("Cihaz Tanımla", file_get_contents('ayarpopupcontent.php', FILE_USE_INCLUDE_PATH));
alertModal("Dikkat", file_get_contents('alertModalContent.php', FILE_USE_INCLUDE_PATH));
$rom = new rooms();
$rooms = $rom->getRooms();
$roomCount = count($rooms);
?>


<div id="mainDiv" class="row"><!--draggable-portlets-->

    <script>

        <?php 
for ($i = 0; $i < $roomCount; $i++) {
    ?>
        document.getElementById("mainDiv").innerHTML += addPanel(<?php 
    echo $rooms[$i]->getHtmlId();
    ?>
, '<?php 
    echo $rooms[$i]->getName();
    ?>
', '', '<?php 
    echo $rooms[$i]->getColor();
    ?>
', <?php 
    echo $rooms[$i]->getCollapsed();
    ?>
Esempio n. 7
0
    get_all();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    new_question_form();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    get_questions();
    ?>
</div></li>
        <li><div class="uk-grid"><?php 
    get_polls();
    ?>
</div></li>
        <li><?php 
    include "user.php";
    ?>
</li>
        <li></li>
      </ul>
    </div><!--div class="uk-width-1-4"></div-->
      <?php 
} else {
    modal("", "setTimeout(function(){window.location = '/login.php'},0);");
}
?>
</div>
</body>
<?php 
include "template/foot.php";
Esempio n. 8
0
 /**
  * Render an emptyl
  *
  * @param null $remoteId
  * @return mixed
  * @throws \Exception
  */
 static function renderRemoteEmptyModal($remoteId = null)
 {
     $modal = modal();
     if (!is_null($remoteId)) {
         $modal->setRemoteId($remoteId);
     }
     return $modal->getRenderer()->render('modal_remote', $modal);
 }
Esempio n. 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $pageId
  * @return \Illuminate\Http\Response
  */
 public function destroy($pageId)
 {
     //try
     try {
         $page = $this->service->delete($pageId);
     } catch (Exception $e) {
         //message
         modal('Error', $e);
         //send back
         return back();
     }
     //message
     alert('Success', 'You have successfully deleted the page <b>' . $page->title . '</b>.');
     //send back
     return back();
 }