Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15045 | Rev 16822 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15045 Rev 15046
Línea 1... Línea 1...
1
<?php 
1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
3
$currentUser    = $this->currentUserHelper();
Línea 4... Línea 4...
4
 
4
 
Línea 11... Línea 11...
11
 
11
 
12
$allowAdd               = $acl->isAllowed($roleName, 'publications/posts/add') ? 1 : 0;
12
$allowAdd               = $acl->isAllowed($roleName, 'publications/posts/add') ? 1 : 0;
13
$allowEdit              = $acl->isAllowed($roleName, 'publications/posts/edit') ? 1 : 0;
13
$allowEdit              = $acl->isAllowed($roleName, 'publications/posts/edit') ? 1 : 0;
Línea 14... Línea 14...
14
$allowDelete            = $acl->isAllowed($roleName, 'publications/posts/delete') ? 1 : 0;
14
$allowDelete            = $acl->isAllowed($roleName, 'publications/posts/delete') ? 1 : 0;
15
 
15
 
Línea 16... Línea 16...
16
$typeURL = \LeadersLinked\Model\Page::TYPE_URL; 
16
$typeURL = \LeadersLinked\Model\Page::TYPE_URL;
17
$typePAGE = \LeadersLinked\Model\Page::TYPE_PAGE; 
17
$typePAGE = \LeadersLinked\Model\Page::TYPE_PAGE;
Línea 18... Línea 18...
18
 
18
 
Línea 320... Línea 320...
320
                if (window.FormData){
320
                if (window.FormData){
321
                    formdata = new FormData(form); //form[0]);
321
                    formdata = new FormData(form); //form[0]);
322
                }
322
                }
Línea 323... Línea 323...
323
    
323
    
324
                $('#modal-add .btn-primary').prop('disabled', true);
324
                $('#modal-add .btn-primary').prop('disabled', true);
325
    
325
                
326
                $.ajax({
326
                $.ajax({
327
                    'dataType'  : 'json',
327
                    'dataType'  : 'json',
328
                    'accept'    : 'application/json',
328
                    'accept'    : 'application/json',
329
                    'method'    : 'post',
329
                    'method'    : 'post',
Línea 332... Línea 332...
332
                    'processData': false,
332
                    'processData': false,
333
                    'contentType': false,
333
                    'contentType': false,
334
                }).done(function(response) {
334
                }).done(function(response) {
335
                    if(response['success']) {
335
                    if(response['success']) {
336
                        $.fn.showSuccess(response['data']);
336
                        $.fn.showSuccess(response['data']);
-
 
337
                        $('#modal-add .btn-primary').prop('disabled', false);
337
                        $('#modal-add').modal('hide');
338
                        $('#modal-add').modal('hide');
Línea 338... Línea 339...
338
                        
339
                        
339
                        gridTable.api().ajax.reload(null, false);
340
                        gridTable.api().ajax.reload(null, false);
340
                    } else {
341
                    } else {
-
 
342
                        validatorAdd.resetForm();
341
                        validatorAdd.resetForm();
343
                        $('#modal-add .btn-primary').prop('disabled',false);
342
                        if(jQuery.type(response['data']) == 'string') {
344
                        if(jQuery.type(response['data']) == 'string') {
343
                            $.fn.showError(response['data']);
345
                            $.fn.showError(response['data']);
344
                        } else  {
346
                        } else  {
345
                            $.each(response['data'], function( fieldname, errors ) {
347
                            $.each(response['data'], function( fieldname, errors ) {
Línea 610... Línea 612...
610
        });
612
        });
611
    });
613
    });
612
JS;
614
JS;
613
$this->inlineScript()->captureEnd();
615
$this->inlineScript()->captureEnd();
614
?>
616
?>
615
  
617
 
616
		
618
 
617
			
619
 
618
<!-- Content Header (Page header) -->
620
<!-- Content Header (Page header) -->
619
<section class="content-header">
621
<section class="content-header">
620
	<div class="container-fluid">
622
    <div class="container-fluid">
621
    	<div class="row mb-2">
623
        <div class="row mb-2">
622
        	<div class="col-sm-12">
624
            <div class="col-sm-12">
623
            	<h1>LABEL_POSTS</h1>
625
                <h1>LABEL_POSTS</h1>
624
			</div>
626
            </div>
625
		</div>
627
        </div>
626
	</div><!-- /.container-fluid -->
628
    </div><!-- /.container-fluid -->
627
</section>
629
</section>
Línea 628... Línea 630...
628
 
630
 
629
<section class="content">
631
<section class="content">
630
	<div class="container-fluid">
632
    <div class="container-fluid">
631
    	<div class="row">
633
        <div class="row">
632
        	<div class="col-12">
634
            <div class="col-12">
633
				<div class="card">                    
635
                <div class="card">
634
					<div class="card-body">
636
                    <div class="card-body">
635
        	    		<table id="gridTable" class="table   table-hover">
637
                        <table id="gridTable" class="table   table-hover">
636
                      		<thead>
638
                            <thead>
637
        						<tr>
639
                                <tr>
638
                                	<th>LABEL_TITLE</th>
640
                                    <th>LABEL_TITLE</th>
639
                                	<th>LABEL_DATE</th>
641
                                    <th>LABEL_DATE</th>
640
                                  	<th>LABEL_ACTIVE</th>
642
                                    <th>LABEL_ACTIVE</th>
641
                                  	<th>LABEL_ACTIONS</th>
643
                                    <th>LABEL_ACTIONS</th>
642
                                </tr>
644
                                </tr>
643
                       		</thead>
645
                            </thead>
644
                         	<tbody>
646
                            <tbody>
645
                         	</tbody>
647
                            </tbody>
646
                    	</table>
648
                        </table>
647
                   	</div>
649
                    </div>
648
                   	<div class="card-footer clearfix">
650
                    <div class="card-footer clearfix">
649
                   		<div style="float:right;">
651
                        <div style="float:right;">
650
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
652
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
651
							<?php if($allowAdd) : ?>
653
                            <?php if ($allowAdd) : ?>
652
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
654
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
653
							<?php endif; ?>
655
                            <?php endif; ?>
654
						</div>
656
                        </div>
655
                 	</div>
657
                    </div>
656
          		</div>
658
                </div>
657
           	</div>     
659
            </div>
658
        </div>          
660
        </div>
659
 	</div>
661
    </div>
Línea 660... Línea 662...
660
</section> 	
662
</section>
661
 
663
 
662
<!-- The Modal -->
664
<!-- The Modal -->
663
<div class="modal" id="modal-add">
665
<div class="modal" id="modal-add">
Línea 664... Línea 666...
664
	<div class="modal-dialog  modal-xl">
666
    <div class="modal-dialog  modal-xl">
665
    	<div class="modal-content">
667
        <div class="modal-content">
666
 
668
 
667
            <!-- Modal Header -->
669
            <!-- Modal Header -->
668
      		<div class="modal-header">
670
            <div class="modal-header">
Línea 669... Línea 671...
669
        		<h4 class="modal-title">LABEL_ADD</h4>
671
                <h4 class="modal-title">LABEL_ADD</h4>
670
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
672
                <button type="button" class="close" data-dismiss="modal">&times;</button>
671
      		</div>
673
            </div>
672
 
674
 
673
            <!-- Modal body -->
675
            <!-- Modal body -->
674
      		<div class="modal-body">
676
            <div class="modal-body">
675
       			 <?php 
677
                <?php
676
                    $form = $this->formAdd;
678
                $form = $this->formAdd;
677
            		$form->setAttributes([
679
                $form->setAttributes([
678
                        'method'    => 'post',
680
                    'method'    => 'post',
679
                        'name'      => 'form-add',
681
                    'name'      => 'form-add',
680
                        'id'        => 'form-add'
682
                    'id'        => 'form-add'
681
                    ]);
683
                ]);
682
    
684
 
683
                    $form->prepare();
685
                $form->prepare();
684
                    echo $this->form()->openTag($form);
686
                echo $this->form()->openTag($form);
685
                    ?>		
687
                ?>
686
                       	<div class="form-group">
688
                <div class="form-group">
687
        					<?php 
689
                    <?php
688
                            $element = $form->get('date');
690
                    $element = $form->get('date');
689
                            $element->setOptions(['label' => 'LABEL_DATE']);
691
                    $element->setOptions(['label' => 'LABEL_DATE']);
690
                            $element->setAttributes(['class' => 'form-control']);
692
                    $element->setAttributes(['class' => 'form-control']);
691
                                            
693
 
692
                            echo $this->formLabel($element);
694
                    echo $this->formLabel($element);
693
                            echo $this->formText($element);
695
                    echo $this->formText($element);
694
                            ?>
696
                    ?>
695
						</div>					
697
                </div>
696
    					<div class="form-group">
698
                <div class="form-group">
697
        					<?php 
699
                    <?php
698
                            $element = $form->get('title');
700
                    $element = $form->get('title');
699
                            $element->setOptions(['label' => 'LABEL_TITLE']);
701
                    $element->setOptions(['label' => 'LABEL_TITLE']);
700
                            $element->setAttributes(['class' => 'form-control']);
702
                    $element->setAttributes(['class' => 'form-control']);
701
                                            
703
 
702
                            echo $this->formLabel($element);
704
                    echo $this->formLabel($element);
703
                            echo $this->formText($element);
705
                    echo $this->formText($element);
704
                            ?>
706
                    ?>
705
						</div>
707
                </div>
706
						<div class="form-group">
708
                <div class="form-group">
707
                    	<?php 
709
                    <?php
708
                            $element = $form->get('description');
710
                    $element = $form->get('description');
709
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
711
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
710
                            $element->setAttributes(['id' => 'description_add', 'class' => 'form-control']);
712
                    $element->setAttributes(['id' => 'description_add', 'class' => 'form-control']);
711
 
713
 
712
                            echo $this->formLabel($element);
714
                    echo $this->formLabel($element);
713
                            echo $this->formTextArea($element);
715
                    echo $this->formTextArea($element);
714
                        ?>
716
                    ?>
715
						</div>
717
                </div>
716
						<div class="form-group">
718
                <div class="form-group">
717
        					<?php 
719
                    <?php
718
                            $element = $form->get('url');
720
                    $element = $form->get('url');
719
                            $element->setOptions(['label' => 'LABEL_URL']);
721
                    $element->setOptions(['label' => 'LABEL_URL']);
720
                            $element->setAttributes(['class' => 'form-control']);
722
                    $element->setAttributes(['class' => 'form-control']);
721
                                            
723
 
722
                            echo $this->formLabel($element);
724
                    echo $this->formLabel($element);
723
                            echo $this->formText($element);
725
                    echo $this->formText($element);
724
                            ?>
726
                    ?>
725
						</div>
727
                </div>
726
						<div class="form-group">
728
                <div class="form-group">
727
                      	<?php 
729
                    <?php
728
                            $element = $form->get('status');
730
                    $element = $form->get('status');
729
                            $element->setAttributes(['class' => 'form-control']);
731
                    $element->setAttributes(['class' => 'form-control']);
730
                            echo $this->formCheckbox($element);
732
                    echo $this->formCheckbox($element);
731
                        ?>
733
                    ?>
732
						</div>
734
                </div>
733
						<div class="form-group">
735
                <div class="form-group">
734
                	
736
 
735
                     		<?php 
737
                    <?php
736
                            $element = $form->get('image');
738
                    $element = $form->get('image');
737
                            $element->setAttributes(['class' => 'form-control']);
739
                    $element->setAttributes(['class' => 'form-control']);
738
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
740
                    $element->setOptions(['label' => 'LABEL_IMAGE']);
739
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
741
                    $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
740
                            echo $this->formLabel($element);
742
                    echo $this->formLabel($element);
741
                            ?>
743
                    ?>
742
                            <div class="file-loading">
744
                    <div class="file-loading">
743
                            <?php echo $this->formFile($element);?>
745
                        <?php echo $this->formFile($element); ?>
744
                            </div>
746
                    </div>
745
                    	
747
 
746
              			</div>
748
                </div>
747
              			<div class="form-group">
749
                <div class="form-group">
748
                    	
750
 
749
                     		<?php 
751
                    <?php
750
                            $element = $form->get('file');
752
                    $element = $form->get('file');
751
                            $element->setAttributes(['class' => 'form-control']);
753
                    $element->setAttributes(['class' => 'form-control']);
752
                            $element->setOptions(['label' => 'LABEL_FILE']);
754
                    $element->setOptions(['label' => 'LABEL_FILE']);
753
                            $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
755
                    $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
754
                            echo $this->formLabel($element);
756
                    echo $this->formLabel($element);
755
                            ?>
757
                    ?>
756
                            <div class="file-loading">
758
                    <div class="file-loading">
757
                            <?php echo $this->formFile($element);?>
759
                        <?php echo $this->formFile($element); ?>
758
                            </div>
760
                    </div>
759
                    	
761
 
760
              			</div>
762
                </div>
761
								
763
 
762
        				<div class="form-group">
764
                <div class="form-group">
763
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
765
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
Línea 764... Línea 766...
764
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
766
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
765
                   		</div>
767
                </div>
766
     	      		<?php echo $this->form()->closeTag($form); ?>
768
                <?php echo $this->form()->closeTag($form); ?>
767
      		</div>
769
            </div>
768
 
770
 
769
            <!-- Modal footer -->
771
            <!-- Modal footer -->
770
      		<div class="modal-footer">
772
            <div class="modal-footer">
771
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
773
                <button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
772
      		</div>
774
            </div>
Línea 773... Línea 775...
773
 
775
 
774
    	</div>
776
        </div>
775
	</div>
777
    </div>
776
</div>   			
778
</div>
Línea 777... Línea 779...
777
			
779
 
778
 
780
 
779
 
781
 
780
<!-- The Modal -->
782
<!-- The Modal -->
781
<div class="modal" id="modal-edit">
783
<div class="modal" id="modal-edit">
Línea 782... Línea 784...
782
	<div class="modal-dialog  modal-xl">
784
    <div class="modal-dialog  modal-xl">
783
    	<div class="modal-content">
785
        <div class="modal-content">
784
 
786
 
785
            <!-- Modal Header -->
787
            <!-- Modal Header -->
786
      		<div class="modal-header">
788
            <div class="modal-header">
787
        		<h4 class="modal-title">LABEL_EDIT</h4>
789
                <h4 class="modal-title">LABEL_EDIT</h4>
788
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
790
                <button type="button" class="close" data-dismiss="modal">&times;</button>
789
      		</div>
791
            </div>
790
 
792
 
791
            <!-- Modal body -->
793
            <!-- Modal body -->
792
      		<div class="modal-body">
794
            <div class="modal-body">
793
       			 <?php 
795
                <?php
794
                    $form = $this->formEdit;
796
                $form = $this->formEdit;
795
            		$form->setAttributes([
797
                $form->setAttributes([
796
                        'method'    => 'post',
798
                    'method'    => 'post',
797
                        'name'      => 'form-edit',
799
                    'name'      => 'form-edit',
798
                        'id'        => 'form-edit'
800
                    'id'        => 'form-edit'
799
                    ]);
801
                ]);
800
    
802
 
801
                    $form->prepare();
803
                $form->prepare();
802
                    echo $this->form()->openTag($form);
804
                echo $this->form()->openTag($form);
803
                    ?>		
805
                ?>
804
                       	<div class="form-group">
806
                <div class="form-group">
805
        					<?php 
807
                    <?php
806
                            $element = $form->get('date');
808
                    $element = $form->get('date');
807
                            $element->setOptions(['label' => 'LABEL_DATE']);
809
                    $element->setOptions(['label' => 'LABEL_DATE']);
808
                            $element->setAttributes(['class' => 'form-control']);
810
                    $element->setAttributes(['class' => 'form-control']);
809
                                            
811
 
810
                            echo $this->formLabel($element);
812
                    echo $this->formLabel($element);
811
                            echo $this->formText($element);
813
                    echo $this->formText($element);
812
                            ?>
814
                    ?>
813
						</div>					
815
                </div>
814
    					<div class="form-group">
816
                <div class="form-group">
815
        					<?php 
817
                    <?php
816
                            $element = $form->get('title');
818
                    $element = $form->get('title');
817
                            $element->setOptions(['label' => 'LABEL_TITLE']);
819
                    $element->setOptions(['label' => 'LABEL_TITLE']);
818
                            $element->setAttributes(['class' => 'form-control']);
820
                    $element->setAttributes(['class' => 'form-control']);
819
                                            
821
 
820
                            echo $this->formLabel($element);
822
                    echo $this->formLabel($element);
821
                            echo $this->formText($element);
823
                    echo $this->formText($element);
822
                            ?>
824
                    ?>
823
						</div>
825
                </div>
824
						<div class="form-group">
826
                <div class="form-group">
825
                    	<?php 
827
                    <?php
826
                            $element = $form->get('description');
828
                    $element = $form->get('description');
827
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
829
                    $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
828
                            $element->setAttributes(['id' => 'description_edit', 'class' => 'form-control']);
830
                    $element->setAttributes(['id' => 'description_edit', 'class' => 'form-control']);
829
 
831
 
830
                            echo $this->formLabel($element);
832
                    echo $this->formLabel($element);
831
                            echo $this->formTextArea($element);
833
                    echo $this->formTextArea($element);
832
                        ?>
834
                    ?>
833
						</div>
835
                </div>
834
						<div class="form-group">
836
                <div class="form-group">
835
        					<?php 
837
                    <?php
836
                            $element = $form->get('url');
838
                    $element = $form->get('url');
837
                            $element->setOptions(['label' => 'LABEL_URL']);
839
                    $element->setOptions(['label' => 'LABEL_URL']);
838
                            $element->setAttributes(['class' => 'form-control']);
840
                    $element->setAttributes(['class' => 'form-control']);
839
                                            
841
 
840
                            echo $this->formLabel($element);
842
                    echo $this->formLabel($element);
841
                            echo $this->formText($element);
843
                    echo $this->formText($element);
842
                            ?>
844
                    ?>
843
						</div>
845
                </div>
844
						<div class="form-group">
846
                <div class="form-group">
845
                      	<?php 
847
                    <?php
846
                            $element = $form->get('status');
848
                    $element = $form->get('status');
847
                            $element->setAttributes(['class' => 'form-control']);
849
                    $element->setAttributes(['class' => 'form-control']);
848
                            echo $this->formCheckbox($element);
850
                    echo $this->formCheckbox($element);
849
                        ?>
851
                    ?>
850
						</div>
852
                </div>
851
						<div class="form-group">
853
                <div class="form-group">
852
                	
854
 
853
                     		<?php 
855
                    <?php
854
                            $element = $form->get('image');
856
                    $element = $form->get('image');
855
                            $element->setAttributes(['class' => 'form-control']);
857
                    $element->setAttributes(['class' => 'form-control']);
856
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
858
                    $element->setOptions(['label' => 'LABEL_IMAGE']);
857
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
859
                    $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
858
                            echo $this->formLabel($element);
860
                    echo $this->formLabel($element);
859
                            ?>
861
                    ?>
860
                            <div class="file-loading">
862
                    <div class="file-loading">
861
                            <?php echo $this->formFile($element);?>
863
                        <?php echo $this->formFile($element); ?>
862
                            </div>
864
                    </div>
863
                    	
865
 
864
              			</div>
866
                </div>
865
              			<div class="form-group">
867
                <div class="form-group">
866
                    	
868
 
867
                     		<?php 
869
                    <?php
868
                            $element = $form->get('file');
870
                    $element = $form->get('file');
869
                            $element->setAttributes(['class' => 'form-control']);
871
                    $element->setAttributes(['class' => 'form-control']);
870
                            $element->setOptions(['label' => 'LABEL_FILE']);
872
                    $element->setOptions(['label' => 'LABEL_FILE']);
871
                            $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
873
                    $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
872
                            echo $this->formLabel($element);
874
                    echo $this->formLabel($element);
873
                            ?>
875
                    ?>
874
                            <div class="file-loading">
876
                    <div class="file-loading">
875
                            <?php echo $this->formFile($element);?>
877
                        <?php echo $this->formFile($element); ?>
876
                            </div>
878
                    </div>
Línea 877... Línea 879...
877
                    	
879
 
878
              			</div>
-
 
879
								
-
 
880
        				<div class="form-group">
-
 
881
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
882
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
-
 
883
                   		</div>
-
 
884
     	      		<?php echo $this->form()->closeTag($form); ?>
-
 
885
      		</div>
-
 
886
 
-
 
887
            <!-- Modal footer -->
-
 
888
      		<div class="modal-footer">
-
 
889
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
-
 
890
      		</div>
-
 
891
 
-
 
892
    	</div>
-
 
893
	</div>
-
 
894
</div>   
880
                </div>
-
 
881
 
-
 
882
                <div class="form-group">
-
 
883
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
884
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
-
 
885
                </div>
-
 
886
                <?php echo $this->form()->closeTag($form); ?>
-
 
887
            </div>
895
	
888