Exemplo n.º 1
0
 public function getEditFormView()
 {
     global $clientRoot;
     $model = $this->model;
     if (strlen($model->getagentteamid()) == 0) {
         $new = TRUE;
     } else {
         $new = FALSE;
     }
     $returnvalue = "\n     <script type='text/javascript'>\n        var frm = \$('#saveATeamRecordForm');\n        frm.submit(function () {\n            \$('#statusDiv').html('Saving...');\n            \$('#saveATeamResultDiv').html('');\n            \$.ajax({\n               type: 'POST',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: frm.serialize(),\n               dataType : 'html',\n               success: function(data){\n                  \$('#saveATeamResultDiv').html(data);\n                  \$('#statusDiv').html('');\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n     </script>\n";
     $returnvalue .= '<div id="saveATeamResultDiv"></div>';
     $returnvalue .= '<form id="saveATeamRecordForm">';
     if ($new) {
         $returnvalue .= '<input type=hidden name=mode id=mode value=savenew>';
     } else {
         $returnvalue .= '<input type=hidden name=mode id=mode value=save>';
     }
     $returnvalue .= '<input type=hidden name=table id=table value="AgentTeams">';
     $returnvalue .= '<input type=hidden name=agentteamid value="' . $model->getagentteamid() . '">';
     $returnvalue .= '<input type=hidden name=teamagentid value="' . $model->getteamagentid() . '">';
     $returnvalue .= '<ul>';
     // $returnvalue .= "<li>TEAMAGENTID<input type=text name=".agentteams::TEAMAGENTID." id=".agentteams::TEAMAGENTID." value='".$model->getteamagentid()."'  size='".agentteams::TEAMAGENTID_SIZE ."'  maxlength='".agentteams::TEAMAGENTID_SIZE ."' ></li>\n";
     $team = new Agent();
     $team->load($model->getteamagentid());
     $returnvalue .= "<li>Team: " . $team->getAssembledName() . "</li>\n";
     $am = new AgentManager();
     $returnvalue .= $am->createAgentPicker(agentteams::MEMBERAGENTID, 'Member', $model->getmemberagentid());
     //$returnvalue .= "<li>Member<input type=text name=".agentteams::MEMBERAGENTID." id=".agentteams::MEMBERAGENTID." value='".$model->getmemberagentid()."'  size='".agentteams::MEMBERAGENTID_SIZE ."'  maxlength='".agentteams::MEMBERAGENTID_SIZE ."' ></li>\n";
     $returnvalue .= "<li>Order<input type=text name=" . agentteams::ORDINAL . " id=" . agentteams::ORDINAL . " value='" . $model->getordinal() . "'  size='" . agentteams::ORDINAL_SIZE . "'  maxlength='" . agentteams::ORDINAL_SIZE . "' ></li>\n";
     $returnvalue .= '<li><input type=submit value="Save"></li>';
     $returnvalue .= '</ul>';
     $returnvalue .= '</form>';
     return $returnvalue;
 }