adrianmak

Members
  • Content count

    526
  • Joined

  • Last visited

Community Reputation

60 Excellent

About adrianmak

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

4,032 profile views
  1. thats mean i used the wrong hook?
  2. i deleted pages on page edit form
  3. I put following code in site/ready.php $this->addHookAfter('Pages::deleteReady', null, function($event) { $p = $event->object; die('page delete'); }); When I delete a page, this hook never run. Should I use the wrong hook for a page delete?
  4. This module only hide pages for non-superuser. But my case is there are certain user roles, i want to hide for a specific user role. The hide pages module will hide all pages for all user roles as they are all non-superuser
  5. I created a page template which which store a copy of user form submission from front-end I created a user role which is responsible to manage these form submission. For example, change a status will send a email acknowledgement to a user. To prevent other irrelevant stuffs to this user role, I would like to hide the Page tab and or hide those irrelevant pages on the pages tree You may said edit the page template access setting. To uncheck view pages for a user role, u have to uncheck the guest user role, this settings affect the front-end too. In other words, all pages cannot view at front-end
  6. I leaned from @soma ModuleManager process module. The js script is written like that. What I key to learn is to pass variable from php to js. The class might be passed from php The code I wrote is just for learning purpose. Probably make nonsense at all.
  7. If the code wrapped in a document ready function, how to pass value to a jquery document ready function ? I checked from internet, there is no way to pass parameter to a jquery document ready function
  8. I wrote a few lines of code to practice. ProcessTest.module <?php class ProcessTest extends Process { function init() { parent::init(); } function ___execute() { $this->config->js("demo", "value passed from process module"); $out = ""; $out .= "<h2 class='tagline'>Process Test module title</h2>"; return $out; } } ProcessTest.js ; (function($, config) { var text = config.demo; $("h2.tagline").addClass("color-red"); console.log(text); })(jQuery, config); ProcessTest.css .color-red { color: #F00; } I could display the string in console.log passed from the module. But the jquery addClass is not working properly. No class added in the selected element.
  9. How to handle user authentication for some RESTful action like update, delete, insert a record
  10. Thank you for explanation........
  11. I'm learning how to write my own module. To learn how to write a module, one of method is to read modules developed by other people. Take Module Manager module which is written by @Soma https://github.com/somatonic/ModulesManager/blob/master/ModulesManager.module While I read thru the source, I could not find a javascript thing load statement to load the ModuleManager.js https://github.com/somatonic/ModulesManager/blob/6ddf1f872b17773cff2426e6f196d4d07c6ee709/ModulesManager.module#L173-L175 I could find only these two lines which is output two javascript variables used by ModuleManager.js. It is not to load the ModuleManager.js for this module. https://github.com/somatonic/ModulesManager/blob/6ddf1f872b17773cff2426e6f196d4d07c6ee709/ModulesManager.module#L173-L175 https://github.com/somatonic/ModulesManager/blob/6ddf1f872b17773cff2426e6f196d4d07c6ee709/ModulesManager.module#L173-L175 Anyone could explain how the module load its own ModuleManager.js file ?
  12. Is it good to fetch all records from database, and using js/jquery lib for pagination and searching ? I was come into a situation, a client's existing website (not developed by me), the implementation for tabular data is fetch all records from database and use js/jquery for pagination and searching. The client asked for a modification to include search for some of other fields from records. Since the search function provided by js lib only search data where columns are populated on the table, other record details not on the columns cannot be search. And the whole tabular data page is fetch from ajax request, for this modification it required to rewrite from scratch for this part. It took too much time to study the code (not using php framework, just vanilla php code) written by others for that modification. And finally I rejected the client's request and asked him to look for someone else for modification
  13. how do i use it on my own module? any example code?
  14. I see.....................thx
  15. Parse Error: syntax error, unexpected '[', expecting ')' (line 46 of /home/intaladmin/domains/intalentlara.com.hk/public_html/site/modules/ProcessRegistration.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. The process module code <?php class ProcessRegistration extends Process { public static function getModuleInfo() { return array( 'title' => 'Course Registration', 'version' => 1, 'summary' => 'Course Registration', 'permission' => 'registration-admin', 'page' => array( 'name' => 'registration', 'parent' => '', 'title' => 'Course Registration' ) ); } public function init() { parent::init(); } public function execute() { $out = ''; $selector = 'template=registration'; $out .= "<div class='container'>"; $out .= "<form action='./' method='post'>"; $out .= "<div style='margin-bottom:10px;margin-top:10px;'><label for='keyword' style='width:100%;font-size:1.25em;'><i class='fa fa-search'></i><strong>Search</strong></label></div>"; $out .= "<div><input class='ui-corner-all' style='width:100%;line-height:2em;font-size:1.5em;' type='text' name='keyword' id='search-box' placeholder='Search by email address' /></div>"; $out .= "<button style='margin:10px 0;' class='ui-button ui-widget ui-corner-all ui-state-default' name='button' value='Add New' type='submit'><span class='ui-button-text'>Search</span></button>"; $out .= "</form>"; $out .= "</div>"; if($this->input->post->keyword) $selector .= ",email_address%=".$this->input->post->keyword; $selector .= ",sort=-created"; $registration = $this->pages->find($selector); if(count($registration)==0) { $out .= "No person registered."; } else { $table = $this->modules->get("MarkupAdminDataTable"); $table->headerRow(["NAME", "TITLE", "EMAIL", "MOBILE", "DATE", "STATUS"]); $table->setEncodeEntities(false); foreach($registration as $reg) { //$status = $this->pages->get(1225)->title; $status = $this->pages->get("$reg->reg_status"); if($status=="1225") { $color = "red"; } elseif($status=="1226") { $color = "green"; } elseif($status=="1227") { $color = "blue"; } $status = "<strong style=color:{$color}>".$this->pages->get("$reg->reg_status")->title."</strong>"; //$status = $reg->reg_status; $data = array( $reg->reg_name, "{$reg->title}"=>$this->config->urls->admin."page/edit/?id=".$reg->id, $reg->email_address, $reg->mobile, date("d M Y h:i:s", $reg->date_submission), $status, ); $table->row($data); } } return $out; } } The error pointed to this line of code $table->headerRow(["NAME", "TITLE", "EMAIL", "MOBILE", "DATE", "STATUS"]); In local development environment, there is no such an error when clicking the process module tab. After upload those local files to public test server, this error occur. The public test server is running php 5.3 local dev server is running 7.0.x PW 2.8.35