Quickstart with Icarus

Installation

To install Icarus on your local machine, follow the below steps:

Step 1 -Clone the git with the Project Name

Use the following command to install framework

git clone https://github.com/ajiabs/icarus.git

Step 2 - Connect To Database

Open project folder > project > config > settings.php. Choose your environment and replace the following code with credentials as per the environment you choose



              define('MYSQL_HOST','HOST NAME');
    		  define('MYSQL_USERNAME','YOUR MYSQL USERNAME');
		      define('MYSQL_PASSWORD','YOUR MYSQL PASSWORD');
		      define('MYSQL_DB','YOUR DATABASE NAME');
		

Step 3 - Import Database

When you clone the project in Git, there is a file db.sql in the folder named SQL. The db.sql file has to be imported to the database. Only then you can have the access to the corresponding project in the database.

icarus > sql > db.sql

Step 4 - Build the application

Open browser,Icarus framework provides a default login.

That is;

Login : administrator

password : qw123#

localhost/icarus/cms

Group

Icarus provides group management to handle sections.Sections can be created by writing configuration for the table for that section in manage sections under a group.Section can be viewed depending on the cms user privileges. If the user does not have the privilege to access the section, then Illegal access error message is displayed.

Click on

    data base > cms_groups > Add 
  

In the table fill out all the fields. The fields are explained below:


		  ├── Group Name 	: provide name of the group
		  |
		  ├── Position  	: Set position to the group
		  |
		  └── Published 	: Set the group is published or not
		

Sections

Icarus provides section management to generate a CRUD operation. Sections can be created by writing configuration for the table for that section in manage sections under a group. Breadcrumb for the section can be defined using "breadCrumbColumn" and will be displayed in the subsections of the section. Decimal point can be given to a column data using ' decimalPoint'. Prefix or postfix can be set to the data of a column using 'prefix' or 'postfix'.

Click on

    data base > cms_sections > Add
  

In the table fill out all the fields. The fields are explained below:


  ├── Section Name   : provide name of the section
  |
  ├── Section Alias  : this will be the URL of the section
  │   
  ├── Table Name     : name of the table in which data is stored. 
  |
  └── Section config : JSON format which defines what all functionality, datas are handled in this section
  |
  | ──Visibilty      :Set the section is published or not.

Section Config

Section config example


 {
	"keyColumn": "emp_id",
	"detailHeaderColumnPrefix": "Employee: ",
	"detailHeaderColumns": [
	"emp_name "
	],
	"orderBy": {
		"emp_id": "DESC"
	},
	"includeJsFiles": [
		"cmsvalidations.js"
	],
	"listColumns": [
		"emp_name",
		"emp_email",
		"emp_dob",
		"emp_gender",
		"emp_designation"
	],
	"showColumns": [
		"emp_name",
		"emp_email",
		"emp_dob",
		"emp_gender",
		"emp_designation"
	],
	"detailColumns": [
		"emp_name",
		"emp_email",
		"emp_dob",
		"emp_gender",
		"emp_designation"
	],
	"columns": {
		"emp_id": {
			"name": "ID",
			"sortable": "true",
			"editoptions": {
				"type": "hidden"
			}
		},
		"emp_name": {
			"name": "Name",
			"searchable": "true",
			"editoptions": {
				"type": "textbox",
				"label": "Name",
				"class": "textbox",
				"validations": [
					"required"
				]
			}
		},
		"emp_email": {
			"name": "Email",
			"searchable": "true",
			"sortable": "true",
			"editoptions": {
				"type": "email",
				"label": "email",
				"class": "textbox",
				"validations": [
					"required", "email"
				]
			}
		},

Here the data has two fields.One is emp_name and another one is an emp_email. We are going to use textboxes for entering the values.

Main sections are,

keyColumn means that the primary key of the particular table.

detailHeaderColumnPrefix means to give the prefix to the view modal

detailHeaderColumns means identify the view modal

orderBy indicates the sorting order

includeJsFiles this part include the js files

listColumns means listing page to display contents

showColumns listing the details in the edit portion

detailColumns means the column visible in the add view of the record

column array will specify the fields needed and the datatype needed.

For example, "field": "emp_name" means that designation name will be stored in the table with the field as emp_name. Beyond that, any other included file provides support for packages, license information, and development.

Likewise,

"type": "textbox" means that the field type in the form will be textbox

"label": "Name" means that the label to be displayed in the form against the textbox will be Designation

"class": "textbox" will assign the css class textbox for the text field

"sortable": "true" makes the column sortable in the listing

"searchable": "true" makes the column searchable in the listing

"validations": [{ "required": "true" }] lets you add validations to the field. For the this tutorial am just adding required validation only

Now that everything is set up correctly, lets dive in to a CRUD Simple CRUD Tutorial