示例#1
0
    public function renderCell($value)
    {
        $imgURL = Util::res($value);
        if ($value != null && $value != "") {
            return <<<HTML
<a target="_blank" href="{$imgURL}">Open File</a>
HTML;
        } else {
            return "";
        }
    }
示例#2
0
 public function checkLogin()
 {
     $crud = $this;
     Auth::checkLogin(function () use($crud) {
         // Get request object
         $req = $crud->getSlim()->request;
         //Get root URI
         $rootUri = $req->getRootUri();
         //Get resource URI
         $resourceUri = $req->getResourceUri();
         $_SESSION["redirect"] = $resourceUri;
         header("Location: " . Util::fullURL("auth/login"));
         die;
     });
 }
示例#3
0
    public function renderCell($value)
    {
        $imgURL = Util::res($value);
        if ($value != null && $value != "") {
            return <<<HTML
<a target="_blank" href="{$imgURL}"><img src="{$imgURL}" alt="" style="max-width: 200px; max-height:70px;"></a>
HTML;
        } else {
            return "";
        }
    }
示例#4
0
 public function testDisplayName()
 {
     $this->assertEquals("User id", Util::displayName("user_id"));
 }
示例#5
0
"></script>
<script src="<?php 
echo Util::res("vendor/almasaeed2010/adminlte/");
?>
dist/js/app.min.js"></script>


<script>
    var crud = new LouisCRUD();

    var BASE_URL = "<?php 
echo "http://" . $_SERVER['SERVER_NAME'];
?>
";
    var RES_URL = "<?php 
echo Util::res("");
?>
";
</script>

<?php 
echo $crud->getBodyEndHTML();
?>

<?php 
echo @$crud->getData("bodyBeforeEnd");
?>

<?php 
echo $debugbarRenderer->render();
?>
示例#6
0
 /**
  * @param LouisCRUD $crud
  * @param string $name
  * @param string $dataType
  */
 public function __construct($crud, $name, $dataType)
 {
     $this->crud = $crud;
     $this->name = $name;
     $this->displayName = Util::displayName($name);
     $this->dataType = $dataType;
     if (LouisString::contains($dataType, "varchar")) {
         $this->fieldType = new TextField();
     } else {
         if (LouisString::contains($dataType, "int")) {
             $this->fieldType = new IntegerType();
         } else {
             if (LouisString::contains($dataType, "text")) {
                 $this->fieldType = new TextArea();
             } else {
                 $this->fieldType = new TextField();
             }
         }
     }
     $this->fieldType->setField($this);
 }
示例#7
0
            </div>
        </form>

    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 2.1.4 -->
<script src="<?php 
echo Util::res("vendor/components/jquery/jquery.min.js");
?>
" type="text/javascript"></script>
<!-- Bootstrap 3.3.2 JS -->
<script src="<?php 
echo Util::res("vendor/almasaeed2010/adminlte/bootstrap/js/bootstrap.min.js");
?>
" type="text/javascript"></script>

<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });
</script>
</body>
</html>
示例#8
0
 /**
  * @param bool echo?
  */
 public function getJSON($echo = true)
 {
     $bean = $this->getBean();
     $fields = $this->getShowFields();
     $output = "";
     $array = [];
     foreach ($fields as $field) {
         $array[$field->getName()] = $field->cellValue($bean);
     }
     $output = Util::prettyJSONPrint(json_encode($array));
     if ($echo) {
         echo $output;
     }
     return $output;
 }
示例#9
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;
    }