randomColor() public static method

Returns a random CSS color.
public static randomColor ( ) : string
return string A random CSS color string.
示例#1
0
文件: Base.php 项目: DSNS-LAB/Dmail
 /**
  * Ensure the share system has a default tasklist share for the current user
  * if the default share feature is activated.
  *
  * @return string|NULL The id of the new default share or NULL if no share
  *                     was created.
  */
 public function ensureDefaultShare()
 {
     /* If the user doesn't own a task list, create one. */
     if (!empty($this->_params['auto_create']) && $this->_user && !count(Nag::listTasklists(true))) {
         $share = $this->_shares->newShare($this->_user, strval(new Horde_Support_Randomid()), $this->_getDefaultShareName());
         $share->set('color', Nag::randomColor());
         $this->_prepareDefaultShare($share);
         $this->_shares->addShare($share);
         return $share->getName();
     }
 }
示例#2
0
 public function __construct($vars)
 {
     parent::__construct($vars, _("Create Task List"));
     $this->addVariable(_("Name"), 'name', 'text', true);
     $v = $this->addVariable(_("Color"), 'color', 'colorpicker', false);
     $v->setDefault(Nag::randomColor());
     if ($GLOBALS['registry']->isAdmin()) {
         $this->addVariable(_("System Task List"), 'system', 'boolean', false, false, _("System task lists don't have an owner. Only administrators can change the task list settings and permissions."));
     }
     $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
     $this->setButtons(array(_("Create")));
 }