17 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
51 public static function evaluate($settings, &$state)
55 if (empty($state[
'asset'])) {
57 if (empty($state[
'assetid'])) {
60 $state[
'asset'] = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($state[
'assetid']);
65 $modes = $settings[
'modes'];
67 foreach ($modes as $mode) {
70 if (!SQ_IN_BACKEND && !SQ_IN_LIMBO && !SQ_IN_LOGIN && !SQ_IN_CRON) {
76 if (SQ_IN_BACKEND) $satisfied = TRUE;
80 if (SQ_IN_LIMBO) $satisfied = TRUE;
84 if (SQ_IN_LOGIN) $satisfied = TRUE;
88 if (SQ_IN_CRON) $satisfied = TRUE;
108 public static function getInterface($settings, $prefix, $write_access=FALSE)
110 $selected = array_get_index($settings,
'modes', Array());
113 echo translate(
'condition_interface_mode_user_in');
127 foreach ($options as $idx => $option) {
128 echo
'<td>'.check_box($prefix.
'['.$idx.
']', $option, in_array($option, $selected)).
'</td>';
129 echo
'<td>'.label(translate(
'condition_interface_mode_'.$option), $prefix.
'['.$idx.
']').
'</td>';
138 foreach ($selected as $mode) {
139 echo
'<li>'.translate(
'condition_interface_mode_'.$mode).
'</li>';
143 $contents = ob_get_clean();
160 $settings[
'modes'] = $request_data;