Esempio n. 1
0
function addThing($postParams)
{
    $c = new Crm();
    $namesTable = $c->getCollNames();
    if (count($postParams) > 0) {
        die($c->addTask($postParams) ? iconv("windows-1251", "utf-8", "Задание добавлено.") : iconv("windows-1251", "utf-8", "Задание не добавлено."));
    }
    foreach ($namesTable as $index => $value) {
        switch ($index) {
            case "id":
                $value = "№";
                break;
            case "add_time":
                $value = "Дата добавления";
                $date = date("Y-m-d");
                $addStr = $addStr . "<dd>{$value}</dt><dt><input type=\"text\" name=\"{$index}\" value=\"{$date}\"></dt> \n";
                break;
            case "todo_time":
                $value = "Дата выполнения";
                $addStr = $addStr . "<dd>{$value}</dt><dt><input type=\"text\" name=\"{$index}\" value=\"\" id=\"datepicker\"></dt> \n";
                break;
            default:
                $addStr = $addStr . "<dd>{$value}</dt><dt><input type=\"text\" name=\"{$index}\" value=\"\"></dt> \n";
                break;
        }
    }
    $addStr = "<dl><form action=\"\" method=\"post\" name =\"addForm\" id=\"addForm\"> {$addStr} \n\t\t<input type=\"submit\" value=\"Сохранить\" />\n\t\t\n\t\t<div id=\"added\"> </div>\n\t\t</form></dl>";
    return $addStr;
}
Esempio n. 2
0
Step 3: Create an Object Passing in 3 Argumments username,password,and link

$test = new CRM("crmadmin","P@ssw0rd1234","http://*****:*****@thehangar.onmicrosoft.com", "kennethA20869", "http://thehangar.crm.dynamics.com/Server/XRMServices/2011/OrganizationData.svc/pcl_ContactSet/(guid'76c14e55-7641-4f1c-8777-e73ef0418cd1')");
$data = $crm->buildJSON($array);
$crm->RetrieveData("http://localhost/php/crm.php");
class Crm
{
    private $username;
    private $password;
    private $url;
    private $post = "POST";
    private $get = "GET";
    function __construct($user, $pass, $CRMurl)
    {
        $this->username = $user;
        $this->password = $pass;
        $this->url = $CRMurl;
    }