Exemplo n.º 1
0
 public function actionDeletePCheckListByEntity()
 {
     $entity_type = $_POST['entity_type'];
     $entity_id = $_POST['entity_id'];
     $pc_id = $_POST['pc_id'];
     $ItemRel = ProcessChecklistItemRel::model()->deleteAll("pcir_entity_type='" . $entity_type . "' AND pcir_entity_id=" . intval($entity_id) . " AND pc_id=" . intval($pc_id));
     if ($ItemRel) {
         echo '{"status":"success"}';
     } else {
         echo '{"status":"fail"}';
     }
 }
Exemplo n.º 2
0
<?php

$CheckList = ProcessChecklistItemRel::model()->getPChecklistByEntity($entity_type, $entity_id);
$i = 0;
echo '<input type="hidden" value="' . count($CheckList->data) . '" id="count_process_check_list" />';
foreach ($CheckList->data as $CheckListItem) {
    $i++;
    $pc_id = $CheckListItem->pc_id;
    $dataProvider = ProcessChecklistItemRel::model()->getPchecklistItemRel($entity_type, $entity_id, $pc_id);
    ?>
    <h4 style="float: left"><?php 
    echo $CheckListItem->process_checklist->pc_name;
    ?>
</h4>
    <a href="#" style="float: right;margin-top: 12px;" onclick="delete_item_by_entity('<?php 
    echo $entity_type;
    ?>
',<?php 
    echo $entity_id;
    ?>
,<?php 
    echo $pc_id;
    ?>
);return false;"><i class="icon-trash"></i></a>
    <?php 
    echo '<div style="clear: both;">';
    $this->widget('bootstrap.widgets.TbGridView', array('id' => 'process-checklist-item-grid-' . $i, 'dataProvider' => $dataProvider, 'template' => '{items}{pager}', 'type' => 'striped', 'rowHtmlOptionsExpression' => 'array("id"=>"row_item_".$data->pcir_id)', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => function ($data) {
        if ($data->pcir_status == 1) {
            return CHtml::checkBox("check_process", true, array('value' => $data->pcir_status, 'onclick' => 'updatePChecklistItem(' . $data->pc_id . ',' . $data->pcir_id . ',0);return false'));
        } else {
            return CHtml::checkBox("check_process", false, array('value' => $data->pcir_status, 'onclick' => 'updatePChecklistItem(' . $data->pc_id . ',' . $data->pcir_id . ',1);return false;'));
Exemplo n.º 3
0
 public function updateProcessChecklistItem($pcir_id, $status)
 {
     $model = ProcessChecklistItemRel::model()->findByPk($pcir_id);
     $model->pcir_status = $status;
     if ($model->save()) {
         return true;
     }
     return false;
 }