:
'conditions' => array('School.active' => !null)
!null true, :
'conditions' => array('School.active' => true)
not-null, :
'conditions' => array('School.active NOT' => null)
'conditions' => array('NOT' => ('School.active' => null))
'options' => array($schools)
$schools - , select optGroup "0". :
<select name="data[User][school_id]" id="UserSchoolId">
<optgroup label="0">
<option value="2">School A</option>
<option value="3">School B</option>
<option value="1">School C</option>
<option value="6">School D</option>
</optgroup>
</select>
, , , . , , html, , .
, CakePHP schools_id select, schools. , , :
echo $this->Form->input(
'school_id',
array(
'label' => 'School *',
'options' => $schools,
'value' => $schools[AuthComponent::user('school_id')],
'disabled' => 'disabled'
)
);
:
<select name="data[User][school_id]" value="School C" id="UserSchoolId">
<option value="2">School A</option>
<option value="3">School B</option>
<option value="1">School C</option>
<option value="6">School D</option>
</select>
- html , , .
, :
$options = ['label' => 'School *'];
if (!AuthComponent::user('admin')) {
$options += [
'value' => AuthComponent::user('school_id'),
'disabled' => 'disabled'
];
}
echo $this->Form->input('school_id', $options);
, - html, . ( ), , school_id ( ) auth'ed / .