'How do I add selecting of tasks in this code rather than performing all Yii

I have a page where 'Tests' are done on tasks. Currently it will load the tasks and clicking Perform it would run the tests on these tasks. But I need to modify in such way that instead of it selecting all the tasks it should allow me to select the tasks to perform tests on using a checkbox on the side of the tasks. The code:

<?php
/* @var $this AssetController */
/* @var $form MyActiveForm */
/* @var $model Asset */
?>    
<?php
foreach ($model->userCheckSpecifications as $userCheckSpec) {
    ?>
    <h3><?= $userCheckSpec->name ?></h3>
    <?php
    $serviceTaskSearch = new ServiceTask;
    $serviceTaskSearch->service_specification_id = $userCheckSpec->id;
    $checkDataProvider = $serviceTaskSearch->search();
    $this->widget('zii.widgets.CListView', array(
        'dataProvider' => $checkDataProvider,
        'itemView' => '_serviceSpecificationTemplate', // refers to the partial view named '_serviceSpecificationTemplate'
        'template' => '{items}',
        'viewData' => array(
            'dataCount' => count($checkDataProvider->data)
        ),
    ));
    ?>
    <div class="clear"></div>
    <?php
    if (!empty($checkDataProvider->data)) {
        $dialogScript = '';
        $dialogScript .= "openDialog('" . Yii::app()->createUrl('assetService/performUserChecks', 
        array('assetId' => $model->id,
         'serviceSpecificationId' => $userCheckSpec->id,
          'parentGridName' => 'user-check-grid')) . "','Perform " . $userCheckSpec->name . " Checks','Perform" . str_replace(" ", "", $userCheckSpec->name) . "ChecksDialog');";


        echo CHtml::button("Perform Checks", array('class' => 'btn btn-primary', "onclick" => $dialogScript));
        ?>
        <div class="clear"></div>
        <?php
    }
}
?>

Code in Asset.php

this code for userCheckSpecifications:

    public function getUserCheckSpecifications()
    {
        $criteria = new CDbCriteria;

        $criteria->compare('t.user_check', 1);
        if ($this->use_model_service_specification) {
            $criteria->compare('t.manufacturer_model_id', $this->manufacturer_model_id);
        } else {
            if (!empty($this->manufacturerModel)) {
                $criteria->compare('t.asset_type_id', $this->manufacturerModel->asset_type_id);
            } else {
                return array();
            }
        }
        $criteria->addCondition('t.organisation_id = :assetOrganisationId OR t.organisation_id = :userOrganisationId');
        $criteria->params[':assetOrganisationId'] = $this->organisation->id;
        $criteria->params[':userOrganisationId'] = Yii::app()->user->userModel->organisation_id;

        return ServiceSpecification::model()->findAll($criteria);
    }

Any and all help gratefully appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source