/**
 * @method
 *
 * Create Tasks
 *
 * @name createZimbraTask
 * @label Create Task
 *
 * @param string | $ServerUrl | Server name and port where Zimbra exists | zimbra.server:port
 * @param string | $username | Valid username to connect to Zimbra server
 * @param string | $preAuthKey | Server Key for SSO authentication
 * @param string | $subject | Mail Subject
 * @param string | $taskName | Task Name
 * @param string | $friendlyName | Friendly Name of the User
 * @param string | $userEmail | Email Address of the User
 * @param string | $priority | Priority of the Task
 * @param string | $allDay | Is All Day Task
 * @param string | $class | Access Scope of the Class
 * @param string | $location | Location of the task
 * @param string | $dueDate | Due Date of the task
 * @param string | $status | Status of the task
 * @param string | $percent | Percentage of Task Completed
 *
 * @return string | $result | Response
 *
 */
function createZimbraTask($ServerUrl, $username, $preAuthKey, $subject, $taskName, $friendlyName, $userEmail, $priority, $allDay, $class, $location, $dueDate, $status, $percent)
{
    $serializeOp = array();
    $serializeOp = array('subject' => $subject, 'taskName' => $taskName, 'friendlyName' => $friendlyName, 'userEmail' => $userEmail, 'priority' => $priority, 'allDay' => $allDay, 'class' => $class, 'location' => $location, 'dueDate' => $dueDate, 'status' => $status, 'percent' => $percent);
    $serializeOp1 = serialize($serializeOp);
    $zimbra = new Zimbra($username, $ServerUrl, $preAuthKey);
    $connectionResult = $zimbra->connect();
    if (!$connectionResult) {
        return "Check userName or Server URL";
    }
    $sXmlArray = $zimbra->addTask($serializeOp1);
    if ($sXmlArray) {
        return "Task Created succesfully";
    } else {
        return "Error in Creating Task";
    }
}