Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 33... Línea 33...
33
 
33
 
34
/**
34
/**
35
 * Define contants for messaging default settings population. For unambiguity of
35
 * Define contants for messaging default settings population. For unambiguity of
36
 * plugin developer intentions we use 4-bit value (LSB numbering):
36
 * plugin developer intentions we use 4-bit value (LSB numbering):
37
 * bit 0 - whether to send message (MESSAGE_DEFAULT_ENABLED)
37
 * bit 0 - whether to send message (MESSAGE_DEFAULT_ENABLED)
38
 * bit 1 - Deprecated: whether to send message (MESSAGE_DEFAULT_LOGGEDOFF). Used to mean only when the user is logged off.
38
 * bit 1 - not used
39
 * bit 2..3 - messaging permission (MESSAGE_DISALLOWED|MESSAGE_PERMITTED|MESSAGE_FORCED)
39
 * bit 2..3 - messaging permission (MESSAGE_DISALLOWED|MESSAGE_PERMITTED|MESSAGE_FORCED)
40
 *
40
 *
41
 * MESSAGE_PERMITTED_MASK contains the mask we use to distinguish permission setting.
41
 * MESSAGE_PERMITTED_MASK contains the mask we use to distinguish permission setting.
Línea 42... Línea -...
42
 */
-
 
43
 
-
 
44
 /**
-
 
45
  * @deprecated since Moodle 4.0. Use MESSAGE_DEFAULT_ENABLED instead.
-
 
46
  * @todo Remove on MDL-73284.
-
 
47
  */
-
 
48
define('MESSAGE_DEFAULT_LOGGEDIN', 0x01); // 0001
-
 
49
 
-
 
50
 /**
-
 
51
  * @deprecated since Moodle 4.0 MDL-73284. Use MESSAGE_DEFAULT_ENABLED instead.
-
 
52
  * @todo Remove on MDL-73284.
-
 
53
  */
-
 
54
define('MESSAGE_DEFAULT_LOGGEDOFF', 0x02); // 0010
42
 */
Línea 55... Línea 43...
55
 
43
 
56
define('MESSAGE_DEFAULT_ENABLED', 0x01); // 0001.
44
define('MESSAGE_DEFAULT_ENABLED', 0x01); // 0001.
57
 
45
 
Línea 58... Línea 46...
58
define('MESSAGE_DISALLOWED', 0x04); // 0100.
46
define('MESSAGE_DISALLOWED', 0x04); // 0100.
Línea 59... Línea 47...
59
define('MESSAGE_PERMITTED', 0x08); // 1000.
47
define('MESSAGE_PERMITTED', 0x08); // 1000.
60
define('MESSAGE_FORCED', 0x0c); // 1100.
-
 
61
 
-
 
62
define('MESSAGE_PERMITTED_MASK', 0x0c); // 1100.
-
 
63
 
-
 
64
/**
-
 
65
 * Set default value for default outputs permitted setting
-
 
66
 * @deprecated since Moodle 4.0 MDL-73284.
-
 
67
 * @todo Remove on MDL-73284.
48
define('MESSAGE_FORCED', 0x0c); // 1100.
68
 */
49
 
69
define('MESSAGE_DEFAULT_PERMITTED', 'permitted');
50
define('MESSAGE_PERMITTED_MASK', 0x0c); // 1100.
70
 
51
 
71
/**
52
/**
Línea 462... Línea 443...
462
 
443
 
463
/**
444
/**
464
 * Translate message default settings from binary value to the array of string
445
 * Translate message default settings from binary value to the array of string
465
 * representing the settings to be stored. Also validate the provided value and
446
 * representing the settings to be stored. Also validate the provided value and
466
 * use default if it is malformed.
-
 
467
 * @todo Remove usage of MESSAGE_DEFAULT_LOGGEDOFF on MDL-73284.
447
 * use default if it is malformed.
468
 *
448
 *
469
 * @param  int    $plugindefault Default setting suggested by plugin
449
 * @param  int    $plugindefault Default setting suggested by plugin
470
 * @param  string $processorname The name of processor
450
 * @param  string $processorname The name of processor
471
 * @return array  $settings array of strings in the order: $locked, $enabled.
451
 * @return array  $settings array of strings in the order: $locked, $enabled.
Línea 501... Línea 481...
501
            break;
481
            break;
502
        default:
482
        default:
503
            $locked = false;
483
            $locked = false;
504
            // It's equivalent to logged in.
484
            // It's equivalent to logged in.
505
            $enabled = $plugindefault & MESSAGE_DEFAULT_ENABLED == MESSAGE_DEFAULT_ENABLED;
485
            $enabled = $plugindefault & MESSAGE_DEFAULT_ENABLED == MESSAGE_DEFAULT_ENABLED;
506
 
-
 
507
            // MESSAGE_DEFAULT_LOGGEDOFF is deprecated but we're checking it just in case.
-
 
508
            $loggedoff = $plugindefault & MESSAGE_DEFAULT_LOGGEDOFF == MESSAGE_DEFAULT_LOGGEDOFF;
-
 
509
            $enabled = $enabled || $loggedoff;
-
 
510
            break;
486
            break;
511
    }
487
    }
Línea 512... Línea 488...
512
 
488
 
513
    return array($locked, $enabled);
489
    return array($locked, $enabled);