protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);

    $n = (int)$options['number'];
    $link = $options['link'];
    if (!is_null($link))
    {
      $linkMember = Doctrine::getTable('Member')->find($link);
      if (!$linkMember)
      {
        throw new Exception("not found member: ".$link);
      }
    }

    for ($i = 0; $i < $n; $i++)
    {
      $member = new Member();
      $member->setName('dummy');
      $member->setIsActive(self::fetchRandomNotActive($options['notactivemember-rate'], $n));
      $member->save();

      $member->setName(sprintf($options['name-format'], $member->getId()));
      $member->save();

      $address = sprintf($options['mail-address-format'], $member->getId());
      $member->setConfig('pc_address', $address);
      $member->setConfig('mobile_address', $address);

      $password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
      $member->setConfig('password', md5($password));

      $this->logSection('member+', $member->getName());
      if (isset($linkMember))
      {
        $memberRelationship1 = new MemberRelationship();
        $memberRelationship1->setMember($member);
        $memberRelationship1->setMemberRelatedByMemberIdFrom($linkMember);
        $memberRelationship1->setIsFriend(true);
        $memberRelationship1->save();

        $memberRelationship2 = new MemberRelationship();
        $memberRelationship2->setMember($linkMember);
        $memberRelationship2->setMemberRelatedByMemberIdFrom($member);
        $memberRelationship2->setIsFriend(true);
        $memberRelationship2->save();
        $this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
      }
    }
  }
 private function addMember($id, $name)
 {
     $session = $this->getSession($id);
     // Check for existing member
     foreach ($session->getMembers() as $candidate) {
         if ($candidate->getName() == $name) {
             $member = $candidate;
             break;
         }
     }
     // Create new member
     if (!isset($member)) {
         $member = new Member();
         $member->setName($name);
         $member->setSession($session);
         $this->save($member);
     }
     // Store name in cookie if not done yet
     if (!isset($_COOKIE['scrum_member_name'])) {
         setcookie('scrum_member_name', $name);
     }
     $result = new stdClass();
     $result->sessionId = $id;
     $result->memberId = $member->getId();
     return $result;
 }
 protected function executeTransaction($conn, $arguments = array(), $options = array())
 {
     $n = (int) $options['number'];
     $link = $options['link'];
     if (null !== $link) {
         $linkMember = Doctrine::getTable('Member')->find($link);
         if (!$linkMember) {
             throw new Exception("not found member: " . $link);
         }
     }
     for ($i = 0; $i < $n; $i++) {
         $member = new Member();
         $member->setName('dummy');
         $member->setIsActive(true);
         $member->save();
         $member->setName(sprintf($options['name-format'], $member->getId()));
         $member->save();
         $address = sprintf($options['mail-address-format'], $member->getId());
         self::setMemberConfig($member->id, 'pc_address', $address);
         self::setMemberConfig($member->id, 'mobile_address', $address);
         $password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
         self::setMemberConfig($member->id, 'password', md5($password));
         $this->logSection('member+', $member->getName());
         if (isset($linkMember)) {
             $memberRelationship1 = new MemberRelationship();
             $memberRelationship1->setMemberIdTo($member->id);
             $memberRelationship1->setMemberIdFrom($linkMember->id);
             $memberRelationship1->setIsFriend(true);
             $memberRelationship1->save();
             $memberRelationship1->free(true);
             $memberRelationship2 = new MemberRelationship();
             $memberRelationship2->setMemberIdTo($linkMember->id);
             $memberRelationship2->setMemberIdFrom($member->id);
             $memberRelationship2->setIsFriend(true);
             $memberRelationship2->save();
             $memberRelationship2->free(true);
             $this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
         }
         $member->free(true);
     }
 }
  private function createCluster($memberNum)
  {
    $memberIds = array();  
    for($i = 0; $i < $memberNum; ++$i)
    {
      $member = new Member();
      $member->setName('dummy');
      $member->setIsActive(true);
      $member->save();       
  
      $memberIds[] = $member->getId();
   
      $member->setName(sprintf('dummy%d', $member->getId()));
      $member->save();       
    
      $address = sprintf('*****@*****.**', $member->getId());

      $this->setMemberConfig($member->getId(), 'pc_address', $address);
      $this->setMemberConfig($member->getId(), 'mobile_address', $address);

      $password = '******';
      $this->setMemberConfig($member->getId(), 'password', md5($password));
      $member->free(true);
    }
    for($i = 0; $i < $memberNum; ++$i)
    {
      for($j = $i + 1; $j < $memberNum; ++$j) 
      {
        if ($i === $j) continue;
        $relation = new MemberRelationship();
        $relation->setMemberIdFrom($memberIds[$i]);
        $relation->setMemberIdTo($memberIds[$j]);
        $relation->setFriend(true);
        $relation->save();     
        $relation->free(true); 
      }
    }
  }
function core_dim_add_company_to_users_dimension($object, $user_dim, $company_ot)
{
    $member = new Member();
    $member->setName($object->getObjectName());
    $member->setObjectTypeId($company_ot->getId());
    $member->setDimensionId($user_dim->getId());
    $member->setDepth(1);
    $member->setParentMemberId(0);
    $member->setObjectId($object->getId());
    $member->save();
    // permisssions
    $sql = "INSERT INTO `" . TABLE_PREFIX . "contact_dimension_permissions` (`permission_group_id`, `dimension_id`, `permission_type`)\n\t\t\t SELECT `c`.`permission_group_id`, " . $user_dim->getId() . ", 'check'\n\t\t\t FROM `" . TABLE_PREFIX . "contacts` `c` \n\t\t\t WHERE `c`.`is_company`=0 AND `c`.`user_type`!=0 AND `c`.`disabled`=0\n\t\t\t ON DUPLICATE KEY UPDATE `dimension_id`=`dimension_id`;";
    DB::execute($sql);
    $sql = "INSERT INTO `" . TABLE_PREFIX . "contact_member_permissions` (`permission_group_id`, `member_id`, `object_type_id`, `can_write`, `can_delete`)\n\t\t\t SELECT `c`.`permission_group_id`, " . $member->getId() . ", `ot`.`id`, (`c`.`object_id` = " . $object->getId() . ") as `can_write`, (`c`.`object_id` = " . $object->getId() . ") as `can_delete`\n\t\t\t FROM `" . TABLE_PREFIX . "contacts` `c` JOIN `" . TABLE_PREFIX . "object_types` `ot` \n\t\t\t WHERE `c`.`is_company`=0 \n\t\t\t \tAND `c`.`user_type`!=0 AND `c`.`disabled`=0\n\t\t\t\tAND `ot`.`type` IN ('content_object', 'comment')\n\t\t\t ON DUPLICATE KEY UPDATE `member_id`=`member_id`;";
    DB::execute($sql);
    return $member;
}
Exemple #6
0
        return $this->status_description;
    }
    //Get message
    public function getMessage()
    {
        return $this->message;
    }
}
//Join status
$sql = "SELECT * FROM users\n\t\t\tINNER JOIN status \n\t\t\tON user_id = fk_user_id \n\t\t\tINNER JOIN descriptions \n\t\t\tON fk_description_id = description_id\n\t\t\tINNER JOIN messages\n\t\t\tON message_id = fk_message_id";
$member_list = array();
if ($query = mysqli_query($dbc, $sql)) {
    while ($row = mysqli_fetch_assoc($query)) {
        $member = new Member();
        $member->setId($row["user_id"]);
        $member->setName($row["user_name"]);
        $member->setImage($row["user_img"]);
        $member->setStatusId($row["fk_description_id"]);
        $member->setStatusDescription($row["description_text"]);
        $member->setMessage($row["message_text"]);
        array_push($member_list, $member);
    }
}
?>
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    	<meta name="theme-color" content="#2D78BB">