Menu
Index > Helpers

todoValueCurrent

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

Description:
Returns Boolean:
- true the TodoValue is current because due date is tomorrow or greater and no contributed assets; false.

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

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

/**
 * Current - due date is tomorrow or greater and no contributed assets.
 * 
 * 
 * @params	$data TodoValue
 * @params	$options
 * @return	Boolean
 */
	public function todoValueCurrent($todo_value, $options = array()) {
		//
		$return		= false;
		//
		if (!$todo_value) {
			//
			return	$return;
		}
		//
		$todo_value	= isset($todo_value[$this->alias][$this->primaryKey]) && strlen($todo_value[$this->alias][$this->primaryKey]) > 0
				? $todo_value[$this->alias]
				: $todo_value;
		//
		$due_date	= date('Y-m-d', strtotime($todo_value['due_date']));
		//
		$today		= date('Y-m-d');
		//
		$validated	= $this->todoValueValidate($todo_value);
		//
		$return		= $due_date > $today && $validated['empty'];
		//
		return		$return;
	}