CodeCharge StudioOnce you add Custom Code to the Event, you will see the code-editing window with the appropriate place to enter the new code.
'//Write your own code here.
with the following lines (PHP):
global $tasks;
if (strlen(CCGetSession("UserLogin")) && $tasks->user_id_assign_to->GetValue() == CCGetSession("UserLogin"))
{
$tasks->task_name->SetValue("<b><font color=\"blue\">".
$tasks->task_name->GetValue()."</font></b>");
}
The following is how the above PHP code works:
if (strlen(CCGetSession("UserLogin")) && $tasks->user_id_assign_to->GetValue() == CCGetSession("UserLogin"))
This is an if condition that is true only if the value of the user_id_assign_to field is equal to the login name of the employee that is currently logged into the system. The employees1_emp_login database field provides the value for the user_id_assign_to field in the grid form. Once you login to the system, the program will recognize your tasks by comparing your login name to the emp_login value of the person that a task is assigned to. UserLogin is one of the session variables used by CodeCharge-generated programs, and it holds the Login name of the currently logged in user until the session expires.
Note:
The following are all default session variables created by CodeCharge Studio:
$tasks->task_name->SetValue("<b><font color=\"blue\">" . $tasks->task_name->GetValue()."</font></b>");
This code is executed if the previous if condition is met. It modifies the value of the task_name field. The field value is replaced with its database value wrapped within HTML code that specifies the font color as blue, and adds HTML <b> tag to make the font bold as well. Additionally, notice that the code is object-oriented and you specify that you want to assign a value to the task_name field in the tasks grid. SetValue is a method of an object, which can be used to modify the object's value.
Next: Preview Tasks List Page