?> </a></td> </tr> </table> <div class="contentfull"> <div class="spacerblock_20"></div> <div><a id="AncCreateNewTeam" href="javascript:;"><?php echo 'Create New'; ?> </a></div> <div class="spacerblock_20"></div> <div id="DivTeamsList" style="display:block;"> <?php if ($teams_count) { while ($do_teams->next()) { $e_detail = new Event("mydb.gotoPage"); $e_detail->addParam("goto", "team_edit.php"); $e_detail->addParam("idteam", $do_teams->idteam); $e_detail->addParam("tablename", "team"); $e_detail->requestSave("eDetail_team", $_SERVER["PHP_SELF"]); echo $do_teams->team_name . ' <a href="' . $e_detail->getUrl() . '" class="linkdetail">edit</a><br />'; } } else { echo '<p>' . 'You have not yet created a team.' . '</p>'; } ?> </div> <!-- Add Team --> <div id="DivCreateNewTeam" style="display:none;margin-top:20px;">
function eventAddContactToTeamCW(Contact $contact) { $do_teams = new Teams(); //gets user's teams which are marked as auto-shared $do_teams->getUserTeamsAutoShared(); if ($do_teams->getNumRows()) { while ($do_teams->next()) { //gets Co-Workers of the team $do_teams_cw = new Teams(); $do_teams_cw->getCoWorkersOfTheTeam($do_teams->idteam); if ($do_teams_cw->getNumRows()) { while ($do_teams_cw->next()) { $this->addNew(); $this->idcontact = $contact->idcontact; $this->idteam = $do_teams->idteam; $this->idcoworker = $do_teams_cw->idco_worker; $this->add(); $this->free(); //building contact view table $do_cv = new ContactView(); $do_cv->table = "userid" . $do_teams_cw->idco_worker . "_contact"; $do_cv->getId($contact->idcontact); if (!$do_cv->hasData()) { $do_cv->addNew(); $do_cv->idcontact = $contact->idcontact; $do_cv->firstname = $contact->firstname; $do_cv->lastname = $contact->lastname; $do_cv->company = $contact->company; $do_cv->idcompany = $contact->idcompany; $do_cv->position = $contact->position; $do_cv->picture = $contact->picture; $do_cv->last_activity = date('Y-m-d h:i:s'); $do_cv->last_update = date('Y-m-d h:i:s'); $do_cv->first_created = date('Y-m-d h:i:s'); $do_cv->add(); $do_cv->free(); } //Conact sharing with Co-Worker $do_cs_check = new ContactSharing(); $contact_shared = $do_cs_check->checkCoWorkerContactRel($contact->idcontact, $do_teams_cw->idco_worker); if (!$contact_shared) { $do_cs = new ContactSharing(); $do_cs->addNew(); $do_cs->iduser = $_SESSION['do_User']->iduser; $do_cs->idcontact = $contact->idcontact; $do_cs->idcoworker = $do_teams_cw->idco_worker; $do_cs->add(); $do_cs->free(); } $do_cs_check->free(); } } else { $this->addNew(); $this->idcontact = $_SESSION['ContactEditSave']->idcontact; $this->idteam = $do_teams->idteam; $this->add(); $this->free(); } $do_teams_cw->free(); } } $do_teams->free(); }