Jump to content

Access to a custom process module and got this error


adrianmak
 Share

Recommended Posts

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...