private function init($tableName, $routeName, $p1 = null, $p2 = null, $p3 = null, $p4 = null, $p5 = null)
 {
     // Table Name set this time ONLY.
     $this->setTable($tableName);
     $this->setTableDisplayName($this->tableDisplayName[$routeName]);
     $this->currentRouteName = $routeName;
     $params = "";
     for ($i = 1; $i <= 5; $i++) {
         $paramName = "p{$i}";
         if (${$paramName} != null) {
             $params .= "/{$p1}";
         } else {
             break;
         }
     }
     // WEB UI Url
     $this->setListViewLink(Util::url($this->groupName . "/" . $routeName . "/list" . $params));
     $this->setCreateLink(Util::url($this->groupName . "/" . $routeName . "/create" . $params));
     $this->setEditLink(Util::url($this->groupName . "/" . $routeName . "/edit/:id" . $params));
     $this->setCreateSuccURL($this->getListViewLink());
     // Export URL
     $this->setExportLink(Util::url($this->groupName . "/" . $routeName . "/export" . $params));
     // API Url
     $this->setCreateSubmitLink(Util::url($this->apiGroupName . "/" . $routeName));
     $this->setListViewJSONLink(Util::url($this->apiGroupName . "/" . $routeName . "/datatables" . $params));
     $this->setEditSubmitLink(Util::url($this->apiGroupName . "/" . $routeName . "/:id"));
     $this->setDeleteLink(Util::url($this->apiGroupName . "/" . $routeName . "/:id"));
 }
Beispiel #2
0
if (isset($_SESSION['msg'])) {
    ?>
            <p class="login-box-msg" style="color: red"><?php 
    echo $_SESSION['msg'];
    ?>
</p>
            <?php 
    unset($_SESSION['msg']);
    ?>
        <?php 
}
?>


        <form action="<?php 
echo Util::url("auth/login");
?>
" method="post">
            <div class="form-group has-feedback">
                <input type="text" class="form-control" placeholder="Username" name="username"/>
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="Password" name="password"/>
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">

                </div>
                <div class="col-xs-4">
Beispiel #3
0
    public function render($echo = false)
    {
        $name = $this->field->getName();
        $display = $this->field->getDisplayName();
        $value = $this->getValue();
        $readOnly = $this->getReadOnlyString();
        $required = $this->getRequiredString();
        $crud = $this->field->getCRUD();
        $uploadURL = Util::url("louislam-crud/upload/json?fullpath=no");
        if ($value != "" && $value != null) {
            $imgURL = Util::res($value);
            $imgTag = <<<HTML
<a href="{$imgURL}" target="_blank" class="btn btn-primary">Open ({$imgURL})</a>
HTML;
            $hideRemoveButton = "";
        } else {
            $imgTag = "";
            $hideRemoveButton = 'style="display: none"';
        }
        $html = <<<HTML
<div class="form-group">
    <label for="upload-{$name}">{$display}</label>

    <input id="upload-{$name}" class="form-control" type="file" {$readOnly} {$required} data-required="{$required}"  />
    <input id="field-{$name}" type="hidden" name="{$name}" value="{$value}"  />

    <div id="image-preview-{$name}" class="image-preview">
                {$imgTag}
        </div>

        <a id="image-remove-{$name}" href="javascript:void(0)" class="btn btn-danger" {$hideRemoveButton}>Remove File</a>
   <br/>   <br/>
HTML;
        $crud->addScript(<<<HTML

        <!-- Remove Required for the upload field -->
    <script>
     \$("#upload-{$name}").removeAttr("required");
    </script>

    <script>

        \$("#image-remove-{$name}").click(function () {
                \$("#image-preview-{$name}").html("");
                \$("#field-{$name}").val("");

                var required = \$("#upload-{$name}").data("required");

                if (required == "required") {
                         \$("#upload-{$name}").attr("required", true);
                }

                \$(this).hide();
        });

       \$("#upload-{$name}").change(function () {

            if (\$(this).val() == "") {
                return;
            }

           var data = new FormData();

            jQuery.each(\$(this)[0].files, function(i, file) {
                data.append("upload", file);
            });

             \$.ajax({
                url: '{$uploadURL}',
                data: data,
                cache: false,
                contentType: false,
                processData: false,
                type: 'POST',
                success: function(data){
                        var img = \$("<a target=\\"_blank\\" class=\\"btn btn-primary\\">Open</a>");
                        img.attr("href", RES_URL + data.url);

                        \$("#image-preview-{$name}").html(img);
                        \$("#field-{$name}").val(data.url);
                        \$("#image-remove-{$name}").show();

                         \$("#upload-{$name}").removeAttr("required");
                }
            });
       });
    </script>

HTML
);
        if ($echo) {
            echo $html;
        }
        return $html;
    }
Beispiel #4
0
    /**
     * Render Field for Create/Edit
     * @param bool|true $echo
     * @return string
     */
    public function render($echo = false)
    {
        $name = $this->field->getName();
        $display = $this->field->getDisplayName();
        $defaultValue = $this->field->getDefaultValue();
        $bean = $this->field->getBean();
        $value = $this->getValue();
        $readOnly = $this->getReadOnlyString();
        $required = $this->getRequiredString();
        $crud = $this->field->getCRUD();
        $uploadURL = \LouisLam\Util::url("louislam-crud/upload");
        $html = <<<HTML
        <label for="field-{$name}">{$display} </label>
        <textarea id="field-{$name}" class="editor" name="{$name}" {$readOnly} {$required} style="width:100%">{$value}</textarea>
HTML;
        $fullFeatures = $this->fullFeatures ? "true" : "false";
        $crud->addScript(<<<HTML

        <script>
        \$(document).ready(function () {
                var element = \$( 'textarea.editor[name={$name}]' );
                var fullFeatures = {$fullFeatures};

              var ckConfig = {
                    height: 600,
                    width: "100%",
                    extraPlugins: 'uploadimage',
                    imageUploadUrl: '{$uploadURL}/json',
                    filebrowserImageUploadUrl: '{$uploadURL}/js',
                    allowedContent: true
                };

                if (fullFeatures) {
                        ckConfig.plugins = "dialogui,dialog,a11yhelp,about,basicstyles,bidi,blockquote,clipboard," +
"button,panelbutton,panel,floatpanel,colorbutton,colordialog,menu," +
"contextmenu,dialogadvtab,div,elementspath,enterkey,entities,popup," +
"filebrowser,find,fakeobjects,flash,floatingspace,listblock,richcombo," +
"font,format,forms,horizontalrule,htmlwriter,iframe,image,indent," +
"indentblock,indentlist,justify,link,list,liststyle,magicline," +
"maximize,newpage,pagebreak,pastefromword,pastetext,preview,print," +
"removeformat,resize,save,menubutton,scayt,selectall,showblocks," +
"showborders,smiley,sourcearea,specialchar,stylescombo,tab,table," +
"tabletools,templates,toolbar,undo,wsc,wysiwygarea";
                        ckConfig.toolbar = 'Full';

                        ckConfig.toolbar_Full = [
                            { name: 'document', items : [ 'Source','-', 'NewPage','DocProps','Preview','Print','-','Templates' ] },
                            { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
                            { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
                            { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton',
                            'HiddenField' ] },
                            '/',
                            { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
                            { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv',
                            '-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
                            { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
                            { name: 'insert', items : [ 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe' ] },
                            '/',
                            { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
                            { name: 'colors', items : [ 'TextColor','BGColor' ] },
                            { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
                    ];
                }

            element.ckeditor(ckConfig);

            element.ckeditor().resize("100%");
        });

        </script>
HTML
);
        if ($echo) {
            echo $html;
        }
        return $html;
    }