本文整理汇总了PHP中Criterion::setMeasurement方法的典型用法代码示例。如果您正苦于以下问题:PHP Criterion::setMeasurement方法的具体用法?PHP Criterion::setMeasurement怎么用?PHP Criterion::setMeasurement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Criterion
的用法示例。
在下文中一共展示了Criterion::setMeasurement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createDashboard
public function createDashboard()
{
$role = new Role();
$role->setDecisionId($this->id);
$role->setName('Collect everything');
$role->setComment('Collect everything is linked to the Overview -page reporting table. <br><br>If you delete this survey your responses on the overview page will be removed.');
$role->setUpdateable(true);
$role->setDashboard(true);
$role->setActive(true);
$response = new Response();
$response->setDecisionId($this->id);
$response->setIpAddress('127.0.0.1');
$response->setEmailAddress('dashboard');
$role->Response->add($response);
$role->Response->save();
if ($this->Template->name == 'Default') {
$role_estimates = new Role();
$role_estimates->setDecisionId($this->id);
$role_estimates->setName('Collect Estimates');
$role_estimates->setUpdateable(false);
$role_estimates->setActive(true);
$role_estimates->save();
$role_value = new Role();
$role_value->setDecisionId($this->id);
$role_value->setName('Collect input on Value');
$role_value->setUpdateable(false);
$role_value->setActive(true);
$role_value->save();
$role_usability = new Role();
$role_usability->setDecisionId($this->id);
$role_usability->setName('Collect input on Usability');
$role_usability->setUpdateable(false);
$role_usability->setActive(true);
$role_usability->save();
$role_feasibility = new Role();
$role_feasibility->setDecisionId($this->id);
$role_feasibility->setName('Collect input on Feasibility');
$role_feasibility->setUpdateable(false);
$role_feasibility->setActive(true);
$role_feasibility->save();
// create the default item for project
$alternative = new Alternative();
$alternative->setDecisionId($this->id);
$alternative->setName('Sample item');
$alternative->setStatus('Reviewed');
$alternative->save();
$popularCriteria = PopularCriterionTable::getInstance()->getDashboardDefaultList();
foreach ($popularCriteria as $popularCriterion) {
$criterion = new Criterion();
$criterion->setName($popularCriterion->name);
$criterion->setMeasurement($popularCriterion->measurement);
$criterion->setDescription($popularCriterion->description);
$criterion->setVariableType($popularCriterion->variable_type);
$criterion->setDecisionId($this->id);
$criterion->save();
// set default response as 3 for default item
if ($popularCriterion->measurement == 'five point scale') {
$alternative_measurement = new AlternativeMeasurement();
$alternative_measurement->setAlternativeHeadId($alternative->id);
$alternative_measurement->setScore(3);
$alternative_measurement->setResponseId($response->id);
$alternative_measurement->setRatingMethod($criterion->getMeasurement());
$alternative_measurement->setCriterionId($criterion->id);
$alternative_measurement->save();
}
// show by default in the Survey (create default matrix of the default roles)
$array = array('Hour Estimate' => $role_estimates->id, 'Feasibility' => $role_feasibility->id, 'Usability' => $role_usability->id, 'Value' => $role_value->id);
if (isset($array[$popularCriterion->name])) {
$planned = new PlannedAlternativeMeasurement();
$planned->setRoleId($array[$popularCriterion->name]);
$planned->setAlternativeId($alternative->id);
$planned->setCriterionId($criterion->id);
$planned->save();
$cplanned = new PlannedCriterionPrioritization();
$cplanned->setCriterionId($criterion->id);
$cplanned->setRoleId($array[$popularCriterion->name]);
$cplanned->save();
}
}
} else {
foreach ($this->Template->CriteriaTemplate as $criterionTemplate) {
$criterion = new Criterion();
$criterion->setDecisionId($this->id);
$criterion->setName($criterionTemplate->name);
$criterion->setMeasurement($criterionTemplate->measurement);
$criterion->setVariableType($criterionTemplate->variable_type);
$criterion->save();
}
foreach ($this->Template->RoleTemplate as $roleTemplate) {
$role = new Role();
$role->setDecisionId($this->id);
$role->setName($roleTemplate->name);
$role->save();
}
}
}