Menu
Index > Helpers

todoValuePending

todoValuePending($todo_value, $options = array())

Description:
Returns Boolean:
- true the TodoValue is pending because due date is tomorrow or greater; contributed assets have not been approved yet; false.

Options:
(array) $todo_value - the TodoValue with 'TodoValue' as an array key.
(array) $options - not employed.

Example:
//
$todoValuePending = $this->Deals->todoValuePending($todo_value);
//
echo 'This Todo is ' . ($todoValuePending ? 'pending' : 'not pending') . '.';

/**
 * Pending - due date is tomorrow or greater; contributed assets have not been approved yet.
 * 
 * 
 * @params	$data TodoValue
 * @params	$options
 * @return	Boolean
 */
	public function todoValuePending($data, $options = array()) {
		//
		$return		= false;
		//
		if (!$data) {
			//
			return	$return;
		}
		//
		$data		= isset($data[$this->alias][$this->primaryKey]) && strlen($data[$this->alias][$this->primaryKey]) > 0
				? $data[$this->alias]
				: $data;
		//
		$due_date	= date('Y-m-d', strtotime($data['due_date']));
		//
		$today		= date('Y-m-d');
		//
		$return		= $due_date > $today && !$this->todoValueEmpty($data) && !$this->testApproved($data);
		//
		return		$return;
	}